Update to latest version

This commit is contained in:
genuineparts 2025-06-24 23:26:25 +02:00
parent 8a89842ec6
commit fe9ecfad73
77 changed files with 1701 additions and 5404 deletions

View file

@ -1,4 +1,4 @@
<?php
<?php global $session;
/**
* Project: BeCast WebEngine - simple site engine
* File: /admin/addgroup.apnl.php
@ -22,7 +22,7 @@
* @author Bernhard Jaud <bernhard at becast dot at>
* @package BcWe core
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @version $Id: b6de49df98d4050265bddcd2e10ea51f57c7d06a $
*/
If (!defined("IN_BCWE_ADMIN")) {
@ -53,100 +53,27 @@ class addgroup_panel extends admin_module{
}
}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();
$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"=>""));
$panel->content.="<br /><br />";
$panel->content.="<table style=\"width: 90%; border-spacing: 2px;\">
<tr>
<th><strong>Rechte</strong></th>
</tr>";
while ($row = $db->fetch_array($result)){
$panel->content.="<tr><td><strong>".$row["text"].":</strong><br />".$panel->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;
}
}
}
?>

View file

@ -22,7 +22,7 @@
* @author Bernhard Jaud <bernhard at becast dot at>
* @package BcWe core
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @version $Id: 220835b018d365f1e1cc18303854a8f657d49831 $
*/
If (!defined("IN_BCWE_ADMIN")) {
die("Dieses Script kann nicht ausserhalb des Frameworks laufen!");

View file

@ -1,4 +1,4 @@
<?php
<?php global $session;
/**
* Project: astat - simple site engine
* File: /admin/editusers.apnl.php
@ -22,7 +22,7 @@
* @author Bernhard Jaud <bernhard at becast dot at>
* @package astat core
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @version $Id: 25cfe5d1f82f94b9aaf583a537432b5fbbf49cfd $
*/
If (!defined("IN_BCWE_ADMIN")) {
die("Dieses Script kann nicht ausserhalb des Frameworks laufen!");
@ -40,7 +40,7 @@ class banips_panel extends admin_module{
$db->query("INSERT INTO `" . $config["prefix"] . "banned_ips` (`ip`,`date`,`reason`) VALUES ('".$db->escape($_POST['ip'])."','".time()."','".$db->escape($_POST["reason"])."')");
$panel->admin_message($lang->_('SUCCESS'),$lang->_('DATASAVED'),True,"banips",3);
}
}elseif($_GET["action"]=='delete' && $_GET['id']){
}elseif(isset($_GET['action']) && $_GET["action"]=='delete' && $_GET['id']){
$db->query("DELETE FROM `" . $config["prefix"] . "banned_ips` WHERE `id`='".intval($_GET['id'])."'");
$panel->admin_message("Ban lifted","The ban was lifted.",True,"banips",3);
}else{
@ -54,27 +54,27 @@ class banips_panel extends admin_module{
$ips[]=$row;
}
$panel->title=$lang->_('BANNEDIPS');
$panel->content.="<table class=\"sortable\" width=\"90%\" cellspacing=\"2\">
$panel->content.="<table class=\"sortable\" style=\"width: 90%; border-spacing: 2px;\">
<tr>
<th align=\"center\">".$lang->_('ID')."</th>
<th class=\"sortable-text\" align=\"center\">".$lang->_('IP')."</th>
<th align=\"center\">".$lang->_('DATE')."</th>
<th align=\"center\">".$lang->_('REASON')."</th>
<th class=\"nosort\" align=\"center\">".$lang->_('ACTION')."</th>
<th style=\"text-align: center;\">".$lang->_('ID')."</th>
<th class=\"sortable-text\" style=\"text-align: center;\">".$lang->_('IP')."</th>
<th style=\"text-align: center;\">".$lang->_('DATE')."</th>
<th style=\"text-align: center;\">".$lang->_('REASON')."</th>
<th class=\"nosort\" style=\"text-align: center;\">".$lang->_('ACTION')."</th>
</tr>";
if(!empty($ips)){
foreach($ips as $i){
$panel->content.="<tr>
<td align=\"center\">".$i['id']."</td>
<td align=\"center\">".$i['ip']."</td>
<td align=\"center\">".date('d.m.Y, H:i',$i['date'])."</td>
<td align=\"center\">".$i['reason']."</td>";
$panel->content.="<td align=\"center\"><a onclick=\"return confirmLink(this, 'Delete this ban?')\" href=\"".$config["path"]."/admin/index.php?panel=banips&amp;action=delete&amp;id=".$i["id"]."\"><img src=\"".$config["path"]."/admin/images/icons/delete.png\" /></a></td>
<td style=\"text-align: center;\">".$i['id']."</td>
<td style=\"text-align: center;\">".$i['ip']."</td>
<td style=\"text-align: center;\">".date('d.m.Y, H:i',$i['date'])."</td>
<td style=\"text-align: center;\">".$i['reason']."</td>";
$panel->content.="<td style=\"text-align: center;\"><a onclick=\"return confirmLink(this, 'Delete this ban?')\" href=\"".$config["path"]."/admin/index.php?panel=banips&amp;action=delete&amp;id=".$i["id"]."\"><img src=\"".$config["path"]."/admin/images/icons/delete.png\" /></a></td>
</tr>";
}
}else{
$panel->content.="<tr>
<td align=\"center\" colspan=\"5\">".$lang->_('NOBANNEDIPS')."</td>
<td style=\"text-align: center;\" colspan=\"5\">".$lang->_('NOBANNEDIPS')."</td>
</tr>";
}
$panel->content.="</table><br />";

View file

@ -1,4 +1,4 @@
<?php
<?php global $session;
/**
* Project: BeCast WebEngine - simple site engine
* File: /admin/config.apnl.php
@ -22,7 +22,7 @@
* @author Bernhard Jaud <bernhard at becast dot at>
* @package BcWe core
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @version $Id: 46136c7b3c8b92ef759a6cae6baa72c7332ee3ff $
*/
If (!defined("IN_BCWE_ADMIN")) {
die("Dieses Script kann nicht ausserhalb des Frameworks laufen!");
@ -60,7 +60,7 @@ class config_panel extends admin_module{
$panel->content.="<h2 class=\"accordion_toggle\">".$key."</h2>
<div class=\"accordion_content\"><table width=\"700px\">";
foreach($val as $v){
$panel->content.="<tr><td><strong>".$v["title"]."</strong><br /><span style=\"font-size:small;\">".$v["description"]."</span><br />".$this->get_option($v["option"],$v["name"])."</td></tr>";
$panel->content.="<tr><td><strong>".$v["title"]."</strong><br /><span style=\"font-size:small;\">".$v["description"]."</span><br />".$panel->get_option($v["option"],$v["name"],$config[$v["name"]])."</td></tr>";
}
$panel->content.="</table></div>";
@ -74,99 +74,6 @@ class config_panel extends admin_module{
//bottomAccordion.activate($$(\'vertical_container .accordion_toggle\')[0]);
</script>';
}
function get_option($option,$name) {
global $config,$db,$panel,$userinfo,$admin,$root,$firephp,$lang;
if($option=="yesno"){
$checked["yes"]="";
$checked["no"]="";
if($config[$name]==1||$config[$name]==True||$config[$name]=="yes"){
$checked["yes"]='checked="checked"';
}else{
$checked["no"]='checked="checked"';
}
$yn=$panel->radio(array("name"=>$name,"value"=>"1"),$checked["yes"],TRUE);
$yn.="Ja";
$yn.=$panel->radio(array("name"=>$name,"value"=>"0"),$checked["no"],TRUE);
$yn.="Nein";
return $yn;
}
if($option=="onoff"){
$checked["on"]="";
$checked["off"]="";
if($config[$name]==1||$config[$name]==True||$config[$name]=="on"){
$checked["on"]='checked="checked"';
}else{
$checked["off"]='checked="checked"';
}
$yn=$panel->radio(array("name"=>$name,"value"=>"1"),$checked["on"],TRUE);
$yn.="An";
$yn.=$panel->radio(array("name"=>$name,"value"=>"0"),$checked["off"],TRUE);
$yn.="Aus";
return $yn;
}
if($option=="language"){
$langs=$lang->getlanguages();
foreach($langs as $lang){
$values[$lang['name']]=$lang['short'];
}
$select=$panel->select($values,$config[$name],$name,"",TRUE);
return $select;
}
if($option=="text"){
$text=$panel->field(array("name"=>$name,"typ"=>"text","value"=>$config[$name]),"",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,"value"=>$config[$name], $a_name[0]=>$value[0],$a_name[1]=>$value[1]),"class=\"mceEditor\"",TRUE);
}else{
$text=$panel->textarea(array("name"=>$name,"value"=>$config[$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,"value"=>$config[$name], $a_name[0]=>$value[0],$a_name[1]=>$value[1]),"",TRUE);
}else{
$text=$panel->textarea(array("name"=>$name,"value"=>$config[$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,$config[$name],$name,"",TRUE);
return $select;
}
}
function meta() {
global $module,$config,$db,$panel,$userinfo,$admin,$root;
$meta='<script type="text/javascript" src="/thirdparty/tiny/tiny_mce_gzip.js"></script>

View file

@ -1,4 +1,4 @@
<?php
<?php global $session;
/**
* Project: astat - simple site engine
* File: /admin/editgroup.apnl.php
@ -22,7 +22,7 @@
* @author Bernhard Jaud <bernhard at becast dot at>
* @package astat core
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @version $Id: 10c6f8d62584734ff49092f4b041ec253a588da0 $
*/
If (!defined("IN_BCWE_ADMIN")) {
die("Dieses Script kann nicht ausserhalb des Frameworks laufen!");
@ -61,18 +61,18 @@ class editgroup_panel extends admin_module{
$panel->content.="<h3>Gruppename:</h3>";
$panel->field(array("name"=>"name","typ"=>"text","value"=>$data["role_name"]));
$panel->content.="<br /><br />";
$panel->content.="<table width=\"90%\" cellspacing=\"2\">
$panel->content.="<table style=\"width: 90%; border-spacing: 2px;\">
<tr>
<th><strong>Rechte</strong></th>
</tr>";
$result = $db->query("SELECT * FROM " . $config["prefix"] . "role_values");
$drow = array();
$result = $db->query("SELECT * FROM `" . $config["prefix"] . "role_values`");
while ($row = $db->fetch_array($result)){
$rval =$db->fetch_array($db->query("SELECT value FROM `" . $config["prefix"] . "roleset` WHERE role_value_id='".$row["id"]."' AND role_id='".$data["id"]."'"));
$row["value"]=$rval["value"];
$rdata[]=$row;
}
foreach ($rdata as $d){
$panel->content.="<tr><td><strong>".$d["text"].":</strong><br />".$this->get_option($d["type"],$d["id"],$d["value"])."</td></tr>";
$rval =$db->fetch_array($db->query("SELECT `value` FROM `" . $config["prefix"] . "roleset` WHERE role_value_id='".$row["id"]."' AND role_id='".$data["id"]."'"));
if(empty($rval["value"])){
$rval["value"] = 0;
}
$panel->content.="<tr><td><strong>".$row["text"].":</strong><br />".$panel->get_option($row["type"],$row["id"],$rval["value"])."</td></tr>";
}
$panel->content.="</table><br />";
$panel->field(array("name"=>"send","typ"=>"hidden","value"=>"1"));
@ -83,7 +83,7 @@ class editgroup_panel extends admin_module{
$panel->parse_page();
}
}elseif($_GET["action"]=="delete" && $_GET["group"]){
}elseif(isset($_GET["action"]) && $_GET["action"]=="delete" && isset($_GET["group"])){
$result=$db->query("SELECT id FROM `" . $config["prefix"] . "role` where `role_name`='User' LIMIT 1");
$row = $db->fetch_array($result);
$db->query("UPDATE `" . $config["prefix"] . "users` SET `role`='".$row["id"]."' WHERE `role`='".intval($_GET["group"])."'");
@ -97,117 +97,35 @@ class editgroup_panel extends admin_module{
$role[]=$row;
}
$panel->title="Vorhandene Rollen";
$panel->content.="<table class=\"sortable\" width=\"90%\" cellspacing=\"2\">
$panel->content.="<table class=\"sortable\" style=\"width: 90%; border-spacing: 2px;\">
<tr>
<th align=\"center\">ID</th>
<th align=\"center\">Name</th>
<th class=\"nosort sortcol\" align=\"center\" width=\"18%\">Aktionen</th>
<th style=\"text-align: center;\">ID</th>
<th style=\"text-align: center;\">Name</th>
<th class=\"nosort sortcol\" style=\"text-align: center; width: 18%\">Aktionen</th>
</tr>";
if(!empty($role)){
foreach($role as $u){
$panel->content.="<tr>
<td align=\"center\">".$u["id"]."</td>
<td align=\"center\">".$u["role_name"]."</td>";
<td style=\"text-align: center;\">".$u["id"]."</td>
<td style=\"text-align: center;\">".$u["role_name"]."</td>";
if(!$u["special_group"]){
$panel->content.="<td align=\"center\"><a onclick=\"return confirmLink(this, 'Willst du wirklich die Gruppe ".$u["role_name"]." l&ouml;schen? Alle Mitglieder dieser Gruppe werden der Gruppe User zugeordnet')\" href=\"".$config["path"]."/admin/index.php?panel=editgroup&amp;action=delete&amp;group=".$u["id"]."\"><img src=\"".$config["path"]."/admin/images/icons/delete.png\" /></a> <a href=\"".$config["path"]."/admin/index.php?panel=editgroup&amp;editgroup=".$u["id"]."\"><img src=\"".$config["path"]."/admin/images/icons/wrench.png\" /></a></td>
$panel->content.="<td style=\"text-align: center;\"><a onclick=\"return confirmLink(this, 'Willst du wirklich die Gruppe ".$u["role_name"]." l&ouml;schen? Alle Mitglieder dieser Gruppe werden der Gruppe User zugeordnet')\" href=\"".$config["path"]."/admin/index.php?panel=editgroup&amp;action=delete&amp;group=".$u["id"]."\"><img src=\"".$config["path"]."/admin/images/icons/delete.png\" /></a> <a href=\"".$config["path"]."/admin/index.php?panel=editgroup&amp;editgroup=".$u["id"]."\"><img src=\"".$config["path"]."/admin/images/icons/wrench.png\" /></a></td>
</tr>";
}else{
$panel->content.="<td align=\"center\"><a href=\"".$config["path"]."/admin/index.php?panel=editgroup&amp;editgroup=".$u["id"]."\"><img src=\"".$config["path"]."/admin/images/icons/wrench.png\" /></a></td></td>
$panel->content.="<td style=\"text-align: center;\"><a href=\"".$config["path"]."/admin/index.php?panel=editgroup&amp;editgroup=".$u["id"]."\"><img src=\"".$config["path"]."/admin/images/icons/wrench.png\" /></a></td></td>
</tr>";
}
}
}else{
$panel->content.="<tr>
<td align=\"center\" colspan=\"5\">Keine Rollen vorhanden.</td>
<td style=\"text-align: center;\" colspan=\"5\">Keine Rollen vorhanden.</td>
</tr>";
}
$panel->content.="</table><br />";
}
}
function get_option($option,$name,$value) {
global $config,$db,$panel,$userinfo,$admin,$root,$firephp;
if($option=="yesno"){
$checked["yes"]="";
$checked["no"]="";
if($value==1||$value==True||$value=="yes"){
$checked["yes"]='checked="checked"';
}else{
$checked["no"]='checked="checked"';
}
$yn=$panel->radio(array("name"=>$name,"value"=>"1"),$checked["yes"],TRUE);
$yn.="Ja";
$yn.=$panel->radio(array("name"=>$name,"value"=>"0"),$checked["no"],TRUE);
$yn.="Nein";
return $yn;
}
if($option=="onoff"){
$checked["on"]="";
$checked["off"]="";
if($value==1||$value==True||$value=="on"){
$checked["on"]='checked="checked"';
}else{
$checked["off"]='checked="checked"';
}
$yn=$panel->radio(array("name"=>$name,"value"=>"1"),$checked["on"],TRUE);
$yn.="An";
$yn.=$panel->radio(array("name"=>$name,"value"=>"0"),$checked["off"],TRUE);
$yn.="Aus";
return $yn;
}
if($option=="text"){
$text=$panel->field(array("name"=>$name,"typ"=>"text","value"=>$value),"",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,"value"=>$value, $a_name[0]=>$value[0],$a_name[1]=>$value[1]),"class=\"mceEditor\"",TRUE);
}else{
$text=$panel->textarea(array("name"=>$name,"value"=>$value),"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,"value"=>$value, $a_name[0]=>$value[0],$a_name[1]=>$value[1]),"",TRUE);
}else{
$text=$panel->textarea(array("name"=>$name,"value"=>$value),"",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,$value,$name,"",TRUE);
return $select;
}
}
function meta() {
global $module,$config,$db,$panel,$userinfo,$admin,$root;
$meta='<script type="text/javascript" src="'.$config["path"].'/js/scriptaculous/prototype.js"></script>

View file

@ -22,7 +22,7 @@
* @author Bernhard Jaud <bernhard at becast dot at>
* @package BcWe core
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @version $Id: 9dc39c20490c4f2db08d39ade0b9455db4ba286a $
*/
If (!defined("IN_BCWE_ADMIN")) {
die("Dieses Script kann nicht ausserhalb des Frameworks laufen!");
@ -46,7 +46,7 @@ class editusers_panel extends admin_module{
if($_POST["password"]!=""){
$pwd=", `password`='".hash("sha256",$salt.$db->escape($_POST["password"]))."', `loginkey`='".$_POST['key']."',`salt` = '".$salt."'";
}
$plugin->run_hook('admin_user_before_update',array('data'=>$_POST,'key'=>$key,'user_fid'=>$session->userdata['fuid']));
$plugin->run_hook('admin_user_before_update',array('data'=>$_POST,'user_fid'=>$session->userdata['fuid']));
$db->query("UPDATE `" . $config["prefix"] . "users` SET `username`='".$db->escape($_POST["name"])."',`realname`='".$db->escape($_POST["realname"])."',`email`='".$db->escape($_POST["email"])."',`from`='".$db->escape($_POST["from"])."',`gender`='".$db->escape($_POST["gender"])."',`bio`='".$db->escape($_POST["bio"])."',`homepage`='".$db->escape($_POST["homepage"])."',`role`='".$db->escape($_POST["role"])."',`active`='".$db->escape($_POST["active"])."',".$pwd." WHERE `uid`='".intval($_POST["uid"])."'");
$_POST['user_fid']=$session->userdata['fuid'];
$plugin->run_hook('admin_user_after_update',array('data'=>$_POST));
@ -108,15 +108,15 @@ class editusers_panel extends admin_module{
$user[]=$row;
}
$panel->title=$lang->_('USERS');
$panel->content.="<table id=\"users\" width=\"90%\" cellspacing=\"2\">
$panel->content.="<table id=\"users\" style=\"width: 90%; border-spacing: 2px;\">
<thead>
<tr>
<th style=\"text-align='center';\">".$lang->_('ID')."</th>
<th style=\"text-align='center';\">".$lang->_('USERNAME')."</th>
<th style=\"text-align='center';\">".$lang->_('REALNAME')."</th>
<th style=\"text-align='center';\">".$lang->_('ROLE')."</th>
<th style=\"text-align='center';\">".$lang->_('STATUS')."</th>
<th style=\"text-align='center';\">".$lang->_('ACTION')."</th>
<th style=\"text-align: center;\">".$lang->_('ID')."</th>
<th style=\"text-align: center;\">".$lang->_('USERNAME')."</th>
<th style=\"text-align: center;\">".$lang->_('REALNAME')."</th>
<th style=\"text-align: center;\">".$lang->_('ROLE')."</th>
<th style=\"text-align: center;\">".$lang->_('STATUS')."</th>
<th style=\"text-align: center;\">".$lang->_('ACTION')."</th>
</tr></thead><tbody>";
if(!empty($user)){
foreach($user as $u){
@ -131,22 +131,22 @@ class editusers_panel extends admin_module{
$u['activestyle']='style="font-style:italic;"';
}
$panel->content.="<tr ".$u['activestyle'].">
<td style=\"text-align='center';\">".$u["uid"]."</td>
<td style=\"text-align='center';\">".$u["username"]."</td>
<td style=\"text-align='center';\">".$u["realname"]."</td>
<td style=\"text-align='center';\">".$u["role_name"]."</td>
<td style=\"text-align='center';\">".$u['activetext']."</td>";
<td style=\"text-align: center;\">".$u["uid"]."</td>
<td style=\"text-align: center;\">".$u["username"]."</td>
<td style=\"text-align: center;\">".$u["realname"]."</td>
<td style=\"text-align: center;\">".$u["role_name"]."</td>
<td style=\"text-align: center;\">".$u['activetext']."</td>";
if($u["uid"]==$session->userdata["uid"]){
$panel->content.="<td style=\"text-align='center';\"><a onclick=\"return confirmLink(this,'".$lang->_('BADIDEA')."')\" href=\"".$config["path"]."/admin/index.php?panel=editusers&amp;action=delete&amp;user=".$u["uid"]."\"><img src=\"".$config["path"]."/admin/images/icons/delete.png\" /></a> <a href=\"".$config["path"]."/admin/index.php?panel=editusers&amp;edituser=".$u["uid"]."\"><img src=\"".$config["path"]."/admin/images/icons/wrench.png\" /></a></td>
$panel->content.="<td style=\"text-align: center;\"><a onclick=\"return confirmLink(this,'".$lang->_('BADIDEA')."')\" href=\"".$config["path"]."/admin/index.php?panel=editusers&amp;action=delete&amp;user=".$u["uid"]."\"><img src=\"".$config["path"]."/admin/images/icons/delete.png\" /></a> <a href=\"".$config["path"]."/admin/index.php?panel=editusers&amp;edituser=".$u["uid"]."\"><img src=\"".$config["path"]."/admin/images/icons/wrench.png\" /></a></td>
</tr>";
}else{
$panel->content.="<td style=\"text-align='center';\"><a onclick=\"return confirmLink(this, '".sprintf($lang->_('DELETEUSER'),$u["username"])."')\" href=\"".$config["path"]."/admin/index.php?panel=editusers&amp;action=delete&amp;user=".$u["uid"]."\"><img src=\"".$config["path"]."/admin/images/icons/delete.png\" /></a> <a href=\"".$config["path"]."/admin/index.php?panel=editusers&amp;edituser=".$u["uid"]."\"><img src=\"".$config["path"]."/admin/images/icons/wrench.png\" /></a></td>
$panel->content.="<td style=\"text-align: center;\"><a onclick=\"return confirmLink(this, '".sprintf($lang->_('DELETEUSER'),$u["username"])."')\" href=\"".$config["path"]."/admin/index.php?panel=editusers&amp;action=delete&amp;user=".$u["uid"]."\"><img src=\"".$config["path"]."/admin/images/icons/delete.png\" /></a> <a href=\"".$config["path"]."/admin/index.php?panel=editusers&amp;edituser=".$u["uid"]."\"><img src=\"".$config["path"]."/admin/images/icons/wrench.png\" /></a></td>
</tr>";
}
}
}else{
$panel->content.="<tr>
<td style=\"text-align='center';\" colspan=\"5\">".$lang->_('NOUSERS')."</td>
<td style=\"text-align: center;\" colspan=\"5\">".$lang->_('NOUSERS')."</td>
</tr>";
}
$panel->content.="</tbody></table><br />";

View file

@ -22,7 +22,7 @@
* @author Bernhard Jaud <bernhard at becast dot at>
* @package BeCast Webengine core
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @version $Id: 28fe87cea02728845f7d402ec06e0268a2b4d472 $
*/
ERROR_REPORTING(E_ALL ^E_NOTICE);
$basepath="";
@ -80,6 +80,9 @@ if(isset($session->userdata['uid']) && $session->userdata['uid']!=0 && ($sessio
$result = $db->query("SHOW TABLE STATUS");
while ($row = $db->fetch_array($result))
{
if(empty($row['Rows'])){
$row['Rows'] = 0;
}
$total_rows += $row['Rows'];
$total_data += $row['Data_length'];
$total_index += $row['Index_length'];

View file

@ -22,7 +22,7 @@
* @author Bernhard Jaud <bernhard at becast dot at>
* @package BcWe core
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @version $Id: e4eaafcfd11039c76025c274425ece9809767876 $
*/
If (!defined("IN_BCWE_ADMIN")) {
@ -65,13 +65,13 @@ class module_panel extends admin_module{
$panel->title="Modulverwaltung";
$panel->content.="<h2>Installierte Module</h2><br />
<table width=\"90%\" cellspacing=\"2\">
<table style=\"width: 90%; border-spacing: 2px;\">
<tr>
<th style=\"text-align='center';\">Modul</th>
<th style=\"text-align='center';\">Version</th>
<th style=\"text-align='center';\">Autor</th>
<th style=\"text-align='center';\">Homepage</th>
<th style=\"text-align='center';\">Aktion</th>
<th style=\"text-align: center;\">Modul</th>
<th style=\"text-align: center;\">Version</th>
<th style=\"text-align: center;\">Autor</th>
<th style=\"text-align: center;\">Homepage</th>
<th style=\"text-align: center;\">Aktion</th>
</tr>";
if(!empty($core->mod_)){
foreach($core->mod_ as $mod){
@ -88,11 +88,11 @@ class module_panel extends admin_module{
$depends.='<br /><span style="font-size: xx-small;">h&auml;ngt ab von: '.$deps;
}
$panel->content.="<tr>
<td style=\"text-align='center';\">".$mod["name"].$depends."</td>
<td style=\"text-align='center';\">".$mod["version"]."</td>
<td style=\"text-align='center';\">".$mod["author"]."</td>
<td style=\"text-align='center';\"><a href=\"".$mod["url"]."\">".$mod["url"]."</a></td>
<td style=\"text-align='center';\"><a onclick=\"return confirmLink(this, 'Willst du wirklich das Modul ".$mod["name"]." deinstallieren? Alle Daten diese Plugins werden gel&ouml;scht!')\" href=\"".$config["path"]."/admin/index.php?panel=module&amp;action=uninstall&amp;module=".$mod["file"]."\">Deinstallieren</a></td>
<td style=\"text-align: center;\">".$mod["name"].$depends."</td>
<td style=\"text-align: center;\">".$mod["version"]."</td>
<td style=\"text-align: center;\">".$mod["author"]."</td>
<td style=\"text-align: center;\"><a href=\"".$mod["url"]."\">".$mod["url"]."</a></td>
<td style=\"text-align: center;\"><a onclick=\"return confirmLink(this, 'Willst du wirklich das Modul ".$mod["name"]." deinstallieren? Alle Daten diese Plugins werden gel&ouml;scht!')\" href=\"".$config["path"]."/admin/index.php?panel=module&amp;action=uninstall&amp;module=".$mod["file"]."\">Deinstallieren</a></td>
</tr>";
unset($deps);
unset($depends);
@ -100,19 +100,19 @@ class module_panel extends admin_module{
}
}else{
$panel->content.="<tr>
<td align=\"center\" colspan=\"5\">Keine Module verf&uuml;gbar.</td>
<td style=\"text-align: center;\" colspan=\"5\">Keine Module verf&uuml;gbar.</td>
</tr>";
}
$panel->content.="</table><br />";
$panel->content.="<h2>Nicht Installierte Module</h2><br />";
$panel->content.="<table width=\"90%\" cellspacing=\"2\">
$panel->content.="<table style=\"width: 90%; border-spacing: 2px;\">
<tr>
<th style=\"text-align='center';\">Modul</th>
<th style=\"text-align='center';\">Version</th>
<th style=\"text-align='center';\">Autor</th>
<th style=\"text-align='center';\">Homepage</th>
<th style=\"text-align='center';\">Aktion</th>
<th style=\"text-align: center;\">Modul</th>
<th style=\"text-align: center;\">Version</th>
<th style=\"text-align: center;\">Autor</th>
<th style=\"text-align: center;\">Homepage</th>
<th style=\"text-align: center;\">Aktion</th>
</tr>";
$modules=$this->avaiable_modules();
@ -131,11 +131,11 @@ class module_panel extends admin_module{
$depends.='<br /><span style="font-size: xx-small;">h&auml;ngt ab von: '.$deps;
}
$panel->content.="<tr>
<td style=\"text-align='center';\">".$mod["name"].$depends."</td>
<td style=\"text-align='center';\">".$mod["version"]."</td>
<td style=\"text-align='center';\">".$mod["author"]."</td>
<td style=\"text-align='center';\"><a href=\"".$mod["url"]."\">".$mod["url"]."</a></td>
<td style=\"text-align='center';\"><a href=\"".$config["path"]."/admin/index.php?panel=module&amp;action=install&amp;module=".$mod["file"]."\">Installieren</a></td>
<td style=\"text-align: center;\">".$mod["name"].$depends."</td>
<td style=\"text-align: center;\">".$mod["version"]."</td>
<td style=\"text-align: center;\">".$mod["author"]."</td>
<td style=\"text-align: center;\"><a href=\"".$mod["url"]."\">".$mod["url"]."</a></td>
<td style=\"text-align: center;\"><a href=\"".$config["path"]."/admin/index.php?panel=module&amp;action=install&amp;module=".$mod["file"]."\">Installieren</a></td>
</tr>";
unset($deps);
unset($depends);
@ -143,7 +143,7 @@ class module_panel extends admin_module{
}
}else{
$panel->content.="<tr>
<td align=\"center\" colspan=\"5\">Keine Module verf&uuml;gbar.</td>
<td style=\"text-align: center;\" colspan=\"5\">Keine Module verf&uuml;gbar.</td>
</tr>";
}
$panel->content.="</table>";

View file

@ -1,4 +1,4 @@
<?php
<?php global $session;
/**
* Project: BeCast WebEngine - simple site engine
* File: /admin/navigation.apnl.php
@ -22,7 +22,7 @@
* @author Bernhard Jaud <bernhard at becast dot at>
* @package BeCast WebEngine core
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @version $Id: 3b8272c8cbeb69ce9d3bda8405887ab373a19d9e $
*/
If (!defined("IN_BCWE_ADMIN")) {
die("Dieses Script kann nicht ausserhalb des Frameworks laufen!");

View file

@ -1,4 +1,4 @@
<?php
<?php global $session;
/**
* Project: BeCast WebEngine - simple site engine
* File: /admin/versions.apnl.php
@ -22,7 +22,7 @@
* @author Bernhard Jaud <bernhard at becast dot at>
* @package BcWe core
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @version $Id: 1eb16074139417e5c0ba8cee93003e66221035d4 $
*/
If (!defined("IN_BCWE_ADMIN")) {
die("Dieses Script kann nicht ausserhalb des Frameworks laufen!");
@ -45,104 +45,101 @@ class versions_panel extends admin_module{
$dir_objects[] = $file_object;
}
$url="http://www.astat.org/versions.php";
$file = @fopen($url,"r");
if($file != false){
$data = @fread($file,"4048");
$xml=new xml();
$out = $xml->parse($data, NULL);
$url="https://webengine.becast.at/index.php?task=versioncheck";
$out = xml2array($url);
if(!empty($out)){
$i=0;
$max=count($out["mod"]);
$max=count($out['release']["mod"]);
while($i<=$max){
$versions[$i]["name"]=$out["mod"][$i];
$versions[$i]["ver"]=$out["ver"][$i];
$versions[$i]["name"]=$out['release']["mod"][$i]["name"];
$versions[$i]["ver"]=$out['release']["mod"][$i]["ver"];
$versions[$i]["file"]=$out['release']["mod"][$i]["file"];
$i++;
}
$vers=$core->ver_major.".".$core->ver_minor.".".$core->ver_rev;
$panel->title="Moduleversionen";
$panel->content.="<table width=\"80%\" cellspacing=\"2\">
$panel->content.="<table style=\"width: 80%;\">
<tr>
<th align=\"center\">Modul</th>
<th align=\"center\">Version</th>
<th align=\"center\">Update</th>
<th style=\"text-align: center;\">Modul</th>
<th style=\"text-align: center;\">Version</th>
<th style=\"text-align: center;\">Update</th>
</tr>";
if($out["relase"]["version"]>$vers){
$panel->content.="<tr><td colspan=\"3\">Diese Version ist nicht mehr aktuell.<br />Besuche <a href=\"http://www.astat.org\">die Projektseite</a> f&uuml;r ein Update</td></tr>";
if($out["release"]["version"]>$vers){
$panel->content.="<tr><td colspan=\"3\">Diese Version ist nicht mehr aktuell.<br />Besuche <a href=\"https://webengine.becast.at\">die Projektseite</a> f&uuml;r ein Update</td></tr>";
}else{
foreach($module as $mod){
$panel->content.="<tr>
<td align=\"center\">".$mod["name"]."</td>
<td align=\"center\">".$mod["ver"]."</td>";
foreach($versions as $v){
if($v["name"]==$mod["name"]){
if($mod["ver"]<$v["ver"]){
$panel->content.="<td align=\"center\"><a href=\"http://projectx.becast.at/get_file.php?file=".urlencode($v["name"])."\">Neue Version verf&uuml;gbar!</a></td>";
}elseif($mod["ver"]==$v["ver"]){
$panel->content.="<td align=\"center\">Aktuell</td>";
}else{
$panel->content.="<td align=\"center\">Modified file?</td>";
}
}
}
$panel->content.="</tr>";
}
foreach($core->mod_ as $mod){
$panel->content.="<tr>
<td align=\"center\"><a href=\"".$mod["url"]."\">".$mod["name"]."<a></td>
<td align=\"center\">".$mod["version"]."</td>";
foreach($module as $mod){
$panel->content.="<tr>
<td style=\"text-align: center;\">".$mod["name"]."</td>
<td style=\"text-align: center;\">".$mod["ver"]."</td>";
foreach($versions as $v){
if($v["name"]==$mod["name"]){
if($mod["version"]<$v["ver"]){
$panel->content.="<td align=\"center\"><a href=\"http://projectx.becast.at/get_file.php?file=".urlencode($v["name"])."\">Neue Version verf&uuml;gbar!</a></td>";
}elseif($mod["version"]==$v["ver"]){
$panel->content.="<td align=\"center\">Aktuell</td>";
}else{
$panel->content.="<td align=\"center\">Modified file?</td>";
}
if($v["name"]==$mod["name"]){
if($mod["ver"]<$v["ver"]){
$panel->content.="<td style=\"text-align: center;\"><a href=\"https://code.ehwurscht.at/genuineparts/BeCastWebEngine/src/branch/main/inc/".urlencode($v["file"])."\">Neue Version verf&uuml;gbar!</a></td>";
}elseif($mod["ver"]==$v["ver"]){
$panel->content.="<td style=\"text-align: center;\">Aktuell</td>";
}else{
$panel->content.="<td style=\"text-align: center;\">Modified file?</td>";
}
}
$panel->content.="</tr>";
}
}
$panel->content.="</table><br />";
$panel->parse_page();
}else{
$panel->title="Moduleversionen";
$panel->content.="Die Versionpr&uuml;fung ist fehlgeschlagen.";
$panel->content.="<table width=\"80%\" cellspacing=\"2\">
<tr>
<th align=\"center\">Modul</th>
<th align=\"center\">Version</th>
</tr>";
foreach($module as $mod){
$panel->content.="<tr>
<td align=\"center\">".$mod["name"]."</td>
<td align=\"center\">".$mod["ver"]."</td>";
$panel->content.="</tr>";
}
$panel->content.="</table><br />";
$panel->parse_page();
}
$panel->title="Datei Infos";
$panel->content.="<table width=\"80%\" cellspacing=\"2\">
<tr>
<th align=\"center\">Datei</th>
<th align=\"center\">Gr&ouml;&szlig;e</th>
<th align=\"center\">zuletzt Ge&auml;ndert</th>
</tr>";
foreach($dir_objects as $files){
$panel->content.="<tr>
<td align=\"center\">".$files["name"]."</td>
<td align=\"center\">".$files["size"]."</td>
<td align=\"center\">".$files["time"]."</td>
</tr>";
}
}
$panel->content.="</tr>";
$panel->content.="</table>";
}
foreach($core->mod_ as $mod){
$panel->content.="<tr>
<td style=\"text-align: center;\"><a href=\"".$mod["url"]."\">".$mod["name"]."<a></td>
<td style=\"text-align: center;\">".$mod["version"]."</td>";
foreach($versions as $v){
if($v["name"]==$mod["name"]){
if($mod["version"]<$v["ver"]){
$panel->content.="<td style=\"text-align: center;\"><a href=\"http://projectx.becast.at/get_file.php?file=".urlencode($v["name"])."\">Neue Version verf&uuml;gbar!</a></td>";
}elseif($mod["version"]==$v["ver"]){
$panel->content.="<td style=\"text-align: center;\">Aktuell</td>";
}else{
$panel->content.="<td style=\"text-align: center;\">Modified file?</td>";
}
}
}
$panel->content.="</tr>";
}
}
$panel->content.="</table><br />";
$panel->parse_page();
}else{
$panel->title="Moduleversionen";
$panel->content.="Die Versionpr&uuml;fung ist fehlgeschlagen.";
$panel->content.="<table style=\"width: 80%;\">
<tr>
<th style=\"text-align: center;\">Modul</th>
<th style=\"text-align: center;\">Version</th>
</tr>";
foreach($module as $mod){
$panel->content.="<tr>
<td style=\"text-align: center;\">".$mod["name"]."</td>
<td style=\"text-align: center;\">".$mod["ver"]."</td>";
$panel->content.="</tr>";
}
$panel->content.="</table><br />";
$panel->parse_page();
}
$panel->title="Datei Infos";
$panel->content.="<table style=\"width: 80%;\">
<tr>
<th style=\"text-align: center;\">Datei</th>
<th style=\"text-align: center;\">Gr&ouml;&szlig;e</th>
<th style=\"text-align: center;\">zuletzt Ge&auml;ndert</th>
</tr>";
foreach($dir_objects as $files){
$panel->content.="<tr>
<td style=\"text-align: center;\">".$files["name"]."</td>
<td style=\"text-align: center;\">".$files["size"]."</td>
<td style=\"text-align: center;\">".$files["time"]."</td>
</tr>";
}
$panel->content.="</table>";
}
function byteConvert( $bytes ) {
@ -180,315 +177,142 @@ class versions_panel extends admin_module{
}
class Xml {
/**
* Xml parser container.
*
* @var resource parser
*/
var $parser;
/**
* Parse result.
*
* @var array pOut
*/
var $pOut = array();
/**
* Contain the overlap tag temporarily .
*
* @var array track
*/
var $track = array();
/**
* Current tag level.
*
* @var string tmpLevel
*/
var $tmpLevel = '';
/**
* Attribut of current tag.
*
* @var array tmpAttrLevel
*/
var $tmpAttrLevel = array();
/**
* Write result.
*
* @var string wOut
*/
var $wOut = '';
/**
* parse
* Set the parser Xml and theses options.
* Xml file could be a string, a file, or curl.
* When the source is loaded, we run the parse.
* After, we clean all the memory and variables,
* and return the result in an array.
*
* @access public
* @param src string Source
* @param typeof string Source type : NULL, FILE, CURL.
* @param encoding string Encoding type.
* @return array
*/
function parse ( $src, $typeof = 'FILE', $encoding = 'UTF-8' ) {
// ini;
// (re)set array;
$this->pOut = array();
$this->parser = xml_parser_create();
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $encoding);
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, 'startHandler', 'endHandler');
xml_set_character_data_handler($this->parser, 'contentHandler');
if(empty($src))
trigger_error('Source could not be empty.', E_USER_ERROR);
// format source;
if($typeof == NULL)
$data = $src;
elseif($typeof == 'FILE') {
$fop = fopen($src, 'r');
$data = null;
while(!feof($fop))
$data .= fread($fop, 1024);
fclose($fop);
function xml2array($url, $get_attributes = 1, $priority = 'tag')
{
$contents = "";
if (!function_exists('xml_parser_create'))
{
return array ();
}
elseif($typeof == 'CURL') {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $src);
curl_setopt($curl, CURLOPT_HEADER, 0);
$data = curl_exec($curl);
curl_close($curl);
$parser = xml_parser_create('');
if (!($fp = @ fopen($url, 'rb')))
{
return array ();
}
else
return trigger_error('Xml parser need data.', E_USER_ERROR);
// parse $data;
$parse = xml_parse($this->parser, $data);
if(!$parse)
return trigger_error('XML Error : %s at line %d.', E_USER_ERROR,
array(xml_error_string(xml_get_error_code($this->parser)),
xml_get_current_line_number($this->parser)));
// destroy parser;
xml_parser_free($this->parser);
// unset extra vars;
unset($data,
$this->track,
$this->tmpLevel);
// remove global tag and return the result;
return $this->pOut[0][key($this->pOut[0])];
}
/**
* startHandler
* Manage the open tag, and these attributs by callback.
* The purpose is to create a pointer : {{int ptr}}.
* If the pointer exists, we have a multi-tag situation.
* Tag name is stocked like : '<tag>'
* Attributs is stocked like : '<tag>-ATTR'
* Return true but built $this->pOut.
*
* @access private
* @param parser resource Parser resource.
* @param tag string Tag name.
* @param attr array Attribut.
* @return bool
*/
function startHandler ( $parser, $tag, $attr ) {
// built $this->track;
$this->track[] = $tag;
// place pointer to the end;
end($this->track);
// temp level;
$this->tmpLevel = key($this->track);
// built attrLevel into $this->tmpAttrLevel
if(isset($this->tmpAttrLevel[$this->tmpLevel]['attrLevel']))
$this->tmpAttrLevel[$this->tmpLevel]['attrLevel']++;
// built $this->pOut;
if(!isset($this->pOut[key($this->track)][$tag])) {
$this->pOut[key($this->track)][$tag] = '{{'.key($this->track).'}}';
if(!isset($this->tmpAttrLevel[$this->tmpLevel]['attrLevel']))
$this->tmpAttrLevel[$this->tmpLevel]['attrLevel'] = 0;
while (!feof($fp))
{
$contents .= fread($fp, 8192);
}
// built attributs;
if(!empty($attr)) {
$this->tmpAttrLevel[$this->tmpLevel][] = $this->tmpAttrLevel[$this->tmpLevel]['attrLevel'];
end($this->tmpAttrLevel[$this->tmpLevel]);
// it's the first attribut;
if(!isset($this->pOut[key($this->track)][$tag.'-ATTR']))
$this->pOut[key($this->track)][$tag.'-ATTR'] = $attr;
// or it's not the first;
else {
// so it's the second;
if(!prev($this->tmpAttrLevel[$this->tmpLevel])) {
$this->pOut[key($this->track)][$tag.'-ATTR'] = array(
current($this->tmpAttrLevel[$this->tmpLevel]) => $this->pOut[key($this->track)][$tag.'-ATTR'],
next($this->tmpAttrLevel[$this->tmpLevel]) => $attr
);
}
// or one other;
fclose($fp);
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, trim($contents), $xml_values);
xml_parser_free($parser);
if (!$xml_values)
return; //Hmm...
$xml_array = array ();
$parents = array ();
$opened_tags = array ();
$arr = array ();
$current = & $xml_array;
$repeated_tag_index = array ();
foreach ($xml_values as $data)
{
unset ($attributes, $value);
extract($data);
$result = array ();
$attributes_data = array ();
if (isset ($value))
{
if ($priority == 'tag')
$result = $value;
else
$this->pOut[key($this->track)][$tag.'-ATTR'][$this->tmpAttrLevel[$this->tmpLevel]['attrLevel']] = $attr;
$result['value'] = $value;
}
}
return true;
}
/**
* contentHandler
* Detect the pointer, or the multi-tag by callback.
* If we have a pointer, the method replaces this pointer by the content.
* Else we have a multi-tag, the method add a element to this array.
* Return true but built $this->pOut.
*
* @access private
* @param parser resource Parser resource.
* @param contentHandler string Tag content.
* @return bool
*/
function contentHandler ( $parser, $contentHandler ) {
// remove all spaces;
if(!preg_match('#^\\\\s*$#', $contentHandler)) {
// $contentHandler is a string;
if(is_string($this->pOut[key($this->track)][current($this->track)])) {
// then $contentHandler is a pointer : {{int ptr}} case 1;
if(preg_match('#{{([0-9]+)}}#', $this->pOut[key($this->track)][current($this->track)]))
$this->pOut[key($this->track)][current($this->track)] = $contentHandler;
// or then $contentHandler is a multi-tag content case 2;
else {
$this->pOut[key($this->track)][current($this->track)] = array(
0 => $this->pOut[key($this->track)][current($this->track)],
1 => $contentHandler
);
}
}
// or $contentHandler is an array;
else {
// then $contentHandler is the multi-tag array case 1;
if(isset($this->pOut[key($this->track)][current($this->track)][0]))
$this->pOut[key($this->track)][current($this->track)][] = $contentHandler;
// or then $contentHandler is a node-tag case 2;
else
$this->pOut[key($this->track)][current($this->track)] = array(
0 => $this->pOut[key($this->track)][current($this->track)],
1 => $contentHandler
);
}
}
return true;
}
/**
* endHandler
* Detect the last pointer by callback.
* Move the last tags block up.
* And reset some temp variables.
* Return true but built $this->pOut.
*
* @access private
* @param parser resource Parser resource.
* @param tag string Tag name.
* @return bool
*/
function endHandler ( $parser, $tag ) {
// if level--;
if(key($this->track) == $this->tmpLevel-1) {
// search up tag;
// use array_keys if an empty tag exists (taking the last tag);
// if it's a normal framaset;
$keyBack = array_keys($this->pOut[key($this->track)], '{{'.key($this->track).'}}');
$count = count($keyBack);
if($count != 0) {
$keyBack = $keyBack[$count-1];
// move this level up;
$this->pOut[key($this->track)][$keyBack] = $this->pOut[key($this->track)+1];
}
// if we have a multi-tag framaset ($count == 0);
else {
// if place is set;
if(isset($this->pOut[key($this->track)][current($this->track)][0])) {
// if it's a string, we built an array;
if(is_string($this->pOut[key($this->track)][current($this->track)]))
$this->pOut[key($this->track)][current($this->track)] = array(
0 => $this->pOut[key($this->track)][current($this->track)],
1 => $this->pOut[key($this->track)+1]
);
// else add an index into the array;
if (isset ($attributes) and $get_attributes)
{
foreach ($attributes as $attr => $val)
{
if ($priority == 'tag')
$attributes_data[$attr] = $val;
else
$this->pOut[key($this->track)][current($this->track)][] = $this->pOut[key($this->track)+1];
$result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr'
}
// else set the place;
else
$this->pOut[key($this->track)][current($this->track)] = array(
0 => $this->pOut[key($this->track)][current($this->track)],
1 => $this->pOut[key($this->track)+1]
);
}
// kick $this->pOut level out;
array_pop($this->pOut);
end($this->pOut);
if ($type == "open")
{
$parent[$level -1] = & $current;
if (!is_array($current) or (!in_array($tag, array_keys($current))))
{
$current[$tag] = $result;
if ($attributes_data)
$current[$tag . '_attr'] = $attributes_data;
$repeated_tag_index[$tag . '_' . $level] = 1;
$current = & $current[$tag];
}
else
{
if (isset ($current[$tag][0]))
{
$current[$tag][$repeated_tag_index[$tag . '_' . $level]] = $result;
$repeated_tag_index[$tag . '_' . $level]++;
}
else
{
$current[$tag] = array (
$current[$tag],
$result
);
$repeated_tag_index[$tag . '_' . $level] = 2;
if (isset ($current[$tag . '_attr']))
{
$current[$tag]['0_attr'] = $current[$tag . '_attr'];
unset ($current[$tag . '_attr']);
}
}
$last_item_index = $repeated_tag_index[$tag . '_' . $level] - 1;
$current = & $current[$tag][$last_item_index];
}
}
elseif ($type == "complete")
{
if (!isset ($current[$tag]))
{
$current[$tag] = $result;
$repeated_tag_index[$tag . '_' . $level] = 1;
if ($priority == 'tag' and $attributes_data)
$current[$tag . '_attr'] = $attributes_data;
}
else
{
if (isset ($current[$tag][0]) and is_array($current[$tag]))
{
$current[$tag][$repeated_tag_index[$tag . '_' . $level]] = $result;
if ($priority == 'tag' and $get_attributes and $attributes_data)
{
$current[$tag][$repeated_tag_index[$tag . '_' . $level] . '_attr'] = $attributes_data;
}
$repeated_tag_index[$tag . '_' . $level]++;
}
else
{
$current[$tag] = array (
$current[$tag],
$result
);
$repeated_tag_index[$tag . '_' . $level] = 1;
if ($priority == 'tag' and $get_attributes)
{
if (isset ($current[$tag . '_attr']))
{
$current[$tag]['0_attr'] = $current[$tag . '_attr'];
unset ($current[$tag . '_attr']);
}
if ($attributes_data)
{
$current[$tag][$repeated_tag_index[$tag . '_' . $level] . '_attr'] = $attributes_data;
}
}
$repeated_tag_index[$tag . '_' . $level]++; //0 and 1 index is already taken
}
}
}
elseif ($type == 'close')
{
$current = & $parent[$level -1];
}
}
// re-temp level;
$this->tmpLevel = key($this->track);
while(isset($this->tmpAttrLevel[$this->tmpLevel+1]))
array_pop($this->tmpAttrLevel);
// kick $this->track level out;
array_pop($this->track);
end($this->track);
return true;
return ($xml_array);
}
}
?>