Hallo, Gast! (Registrieren)

Letzte Ankündigung: MyBB 1.8.38 veröffentlicht (30.04.24)


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste
[NG] PMs exportieren in html
#1
Es kommt eine leere Seite:
Zitat:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Wenn es keine gibt, kommt die passende Fehlermeldung. TXT und CSV geht
[Bild: banner.png]

Bitte die Foren-Regeln beachten und im Profil die verwendete MyBB-Version angeben.
#2
Der Fehler ist bekannt.

Versuche es so:

Öffne die Datei private.php und suche nach
PHP-Code:
elseif($mybb->input['action'] == "do_export")
{
    
$plugins->run_hooks("private_do_export_start");
    
$lang->private_messages_for sprintf($lang->private_messages_for$mybb->user['username']);
    
$exdate mydate($mybb->settings['dateformat'], time(), 00);
    
$extime mydate($mybb->settings['timeformat'], time(), 00);
    
$lang->exported_date sprintf($lang->exported_date$exdate$extime);
    
$foldersexploded explode("$%%$"$mybb->user['pmfolders']);
    if(
$mybb->input['pmid'])
    {
        
$wsql "pmid='".intval($mybb->input['pmid'])."' AND uid='".$mybb->user[uid]."'";
    }
    else
    {
        if(
$mybb->input['daycut'] && ($mybb->input['dayway'] != "all"))
        {
            
$datecut time()-($daycut 86400);
            
$wsql "pm.dateline";
            if(
$mybb->input['dayway'] == "older")
            {
                
$wsql .= "<=";
            }
            elseif(
$mybb->input['dayway'] == "newer")
            {
                
$wsql .= ">=";
            }
            
$wsql .= "'$datecut'";
        }
        else
        {
            
$wsql "1=1";
        }
        if(
is_array($mybb->input['exportfolders']))
        {
            
reset($mybb->input['exportfolders']);
            while(list(
$key$val) = each($mybb->input['exportfolders']))
            {
                
$val addslashes($val);
                if(
$val == "all")
                {
                    
$folderlst "";
                    break;
                }
                else
                {
                    if(!
$folderlst)
                    {
                        
$folderlst " AND pm.folder IN ('$val'";
                    }
                    else
                    {
                        
$folderlst .= ",'$val'";
                    }
                }
            }
            if(
$folderlst)
            {
                
$folderlst .= ")";
            }
            
$wsql .= "$folderlst";
        }
        else
        {
            
error($lang->error_pmnoarchivefolders);
        }
        if(
$mybb->input['exportunread'] != "yes")
        {
            
$wsql .= " AND pm.status!='0'";
        }
    }
    if(
$mybb->input['exporttype'] != "html" && $mybb->input['exporttype'] != "csv")
    {
        
$exporttype "txt";
    }
    
$query $db->query("SELECT pm.*, fu.username AS fromusername, tu.username AS tousername FROM ".TABLE_PREFIX."privatemessages pm LEFT JOIN ".TABLE_PREFIX."users fu ON (fu.uid=pm.fromid) LEFT JOIN ".TABLE_PREFIX."users tu ON (tu.uid=pm.toid) WHERE $wsql AND pm.uid='".$mybb->user[uid]."' ORDER BY pm.folder ASC, pm.dateline DESC");
    
$numpms $db->num_rows($query);
    if(!
$numpms)
    {
        
error($lang->error_nopmsarchive);
    }
    while(
$message $db->fetch_array($query))
    {
        if(
$message['folder'] == || $message['folder'] == 3)
        { 
// Sent Items or Drafts Folder Check
            
if($message['toid'])
            {
                
$tofromuid $message['toid'];
                
$tofromusername "<a href=\"member.php?action=profile&uid=$tofromuid\">$message[tousername]</a>";
            }
            else
            {
                
$tofromusername $lang->not_sent;
            }
            
$tofrom $lang->to;
        }
        else
        {
            
$tofromuid $message['fromid'];
            
$tofromusername "<a href=\"member.php?action=profile&uid=$tofromuid\">$message[fromusername]</a>";
            if(
$tofromuid == -2)
            {
                
$tofromusername "MyBB Engine";
            }
            
$tofrom $lang->from;
        }
        if(
$tofromuid == -2)
        {
            
$message['fromusername'] = "MyBB Engine";
        }
        if(!
$message['toid'])
        {
            
$message['tousername'] = $lang->not_sent;
        }

        
$message['subject'] = $message['subject'];
        if(
$message['folder'] != "3")
        {
            
$senddate mydate($mybb->settings['dateformat'], $message['dateline'], 00);
            
$sendtime mydate($mybb->settings['timeformat'], $message['dateline'], 00);
            
$senddate .= $lang->at $sendtime";
        }
        else
        {
            
$senddate $lang->not_sent;
        }
        if(
$mybb->input['exporttype'] == "html")
        {
            
$message['message'] = postify($message['message'], $mybb->settings['pmsallowhtml'], $mybb->settings['pmsallowmycode'], "no"$mybb->settings['pmsallowimgcode']);
            
// do me code
            
if($mybb->settings['pmsallowmycode'] != "no")
            {
                
$message['message'] = domecode($message['message'], $message['username']);
            }
        }
        if(
$mybb->input['exporttype'] == "txt" || $mybb->input['exporttype'] == "csv")
        {
            
$message['message'] = str_replace("\r\n""\n"$message['message']);
            
$message['message'] = str_replace("\n""\r\n"$message['message']);
        }
        if(!
$donefolder[$message['folder']])
        {
            
reset($foldersexploded);
            while(list(
$key$val) = each($foldersexploded))
            {
                
$folderinfo explode("**"$val2);
                if(
$folderinfo[0] == $message['folder'])
                {
                    
$foldername $folderinfo[1];
                    if(
$exporttype != "csv")
                    {
                        eval(
"\$pmsdownload .= \"".$templates->get("private_archive_".$exporttype."_folderhead"10)."\";");
                    }
                    
$donefolder[$message['folder']] = 1;                
                }
            }
        }
        eval(
"\$pmsdownload .= \"".$templates->get("private_archive_".$exporttype."_message"10)."\";");
        
$ids .= ",'$message[pmid]'";
    }
    
$query $db->query("SELECT css FROM ".TABLE_PREFIX."themes WHERE tid='$theme[tid]'");
    
$css $db->result($query0);

    eval(
"\$archived = \"".$templates->get("private_archive_".$exporttype10)."\";");
    if(
$mybb->input['deletepms'] == "yes")
    { 
// delete the archived pms
        
$db->query("DELETE FROM ".TABLE_PREFIX."privatemessages WHERE pmid IN (''$ids)");
    }
    if(
$mybb->input['exporttype'] == "html")
    {
        
$filename "pm-archive.html";
    }
    elseif(
$mybb->input['exporttype'] == "csv")
    {
        
$filename "pm-archive.csv";
    }
    else
    {
        
$filename "pm-archive.txt";
    }
    
$archived ereg_replace("\\\'","'",$archived);
    
header("Content-disposition: filename=$filename");
    
header("Content-type: unknown/unknown");
    
$plugins->run_hooks("private_do_export_end");
    if(
$mybb->input['exporttype'] == "html")
    {
        
outputpage($archived);
    }
    else
    {
        echo 
$archived;
    }

Ersetzen durch
PHP-Code:
elseif($mybb->input['action'] == "do_export")
{
    
$plugins->run_hooks("private_do_export_start");
    
$lang->private_messages_for sprintf($lang->private_messages_for$mybb->user['username']);
    
$exdate mydate($mybb->settings['dateformat'], time(), 00);
    
$extime mydate($mybb->settings['timeformat'], time(), 00);
    
$lang->exported_date sprintf($lang->exported_date$exdate$extime);
    
$foldersexploded explode("$%%$"$mybb->user['pmfolders']);
    if(
$mybb->input['pmid'])
    {
        
$wsql "pmid='".intval($mybb->input['pmid'])."' AND uid='".$mybb->user[uid]."'";
    }
    else
    {
        if(
$mybb->input['daycut'] && ($mybb->input['dayway'] != "all"))
        {
            
$datecut time()-($daycut 86400);
            
$wsql "pm.dateline";
            if(
$mybb->input['dayway'] == "older")
            {
                
$wsql .= "<=";
            }
            elseif(
$mybb->input['dayway'] == "newer")
            {
                
$wsql .= ">=";
            }
            
$wsql .= "'$datecut'";
        }
        else
        {
            
$wsql "1=1";
        }
        if(
is_array($mybb->input['exportfolders']))
        {
            
reset($mybb->input['exportfolders']);
            while(list(
$key$val) = each($mybb->input['exportfolders']))
            {
                
$val addslashes($val);
                if(
$val == "all")
                {
                    
$folderlst "";
                    break;
                }
                else
                {
                    if(!
$folderlst)
                    {
                        
$folderlst " AND pm.folder IN ('$val'";
                    }
                    else
                    {
                        
$folderlst .= ",'$val'";
                    }
                }
            }
            if(
$folderlst)
            {
                
$folderlst .= ")";
            }
            
$wsql .= "$folderlst";
        }
        else
        {
            
error($lang->error_pmnoarchivefolders);
        }
        if(
$mybb->input['exportunread'] != "yes")
        {
            
$wsql .= " AND pm.status!='0'";
        }
    }
    
$query $db->query("SELECT pm.*, fu.username AS fromusername, tu.username AS tousername FROM ".TABLE_PREFIX."privatemessages pm LEFT JOIN ".TABLE_PREFIX."users fu ON (fu.uid=pm.fromid) LEFT JOIN ".TABLE_PREFIX."users tu ON (tu.uid=pm.toid) WHERE $wsql AND pm.uid='".$mybb->user[uid]."' ORDER BY pm.folder ASC, pm.dateline DESC");
    
$numpms $db->num_rows($query);
    if(!
$numpms)
    {
        
error($lang->error_nopmsarchive);
    }
    while(
$message $db->fetch_array($query))
    {
        if(
$message['folder'] == || $message['folder'] == 3)
        { 
// Sent Items or Drafts Folder Check
            
if($message['toid'])
            {
                
$tofromuid $message['toid'];
                
$tofromusername "<a href=\"member.php?action=profile&uid=$tofromuid\">$message[tousername]</a>";
            }
            else
            {
                
$tofromusername $lang->not_sent;
            }
            
$tofrom $lang->to;
        }
        else
        {
            
$tofromuid $message['fromid'];
            
$tofromusername "<a href=\"member.php?action=profile&uid=$tofromuid\">$message[fromusername]</a>";
            if(
$tofromuid == -2)
            {
                
$tofromusername "MyBB Engine";
            }
            
$tofrom $lang->from;
        }
        if(
$tofromuid == -2)
        {
            
$message['fromusername'] = "MyBB Engine";
        }
        if(!
$message['toid'])
        {
            
$message['tousername'] = $lang->not_sent;
        }

        
$message['subject'] = $message['subject'];
        if(
$message['folder'] != "3")
        {
            
$senddate mydate($mybb->settings['dateformat'], $message['dateline'], 00);
            
$sendtime mydate($mybb->settings['timeformat'], $message['dateline'], 00);
            
$senddate .= $lang->at $sendtime";
        }
        else
        {
            
$senddate $lang->not_sent;
        }
        if(
$mybb->input['exporttype'] == "html")
        {
            
$message['message'] = postify($message['message'], $mybb->settings['pmsallowhtml'], $mybb->settings['pmsallowmycode'], "no"$mybb->settings['pmsallowimgcode']);
            
// do me code
            
if($mybb->settings['pmsallowmycode'] != "no")
            {
                
$message['message'] = domecode($message['message'], $message['username']);
            }
        }
        if(
$mybb->input['exporttype'] == "txt" || $mybb->input['exporttype'] == "csv")
        {
            
$message['message'] = preg_replace("#(\r\n|\r|\n)#s""\r\n"$message['message']);
        }
        if(!
$donefolder[$message['folder']])
        {
            
reset($foldersexploded);
            while(list(
$key$val) = each($foldersexploded))
            {
                
$folderinfo explode("**"$val2);
                if(
$folderinfo[0] == $message['folder'])
                {
                    
$foldername $folderinfo[1];
                    if(
$mybb->input['exporttype'] != "csv")
                    {
                        eval(
"\$pmsdownload .= \"".$templates->get("private_archive_".$mybb->input['exporttype']."_folderhead"10)."\";");
                    }
                    
$donefolder[$message['folder']] = 1;                
                }
            }
        }
        eval(
"\$pmsdownload .= \"".$templates->get("private_archive_".$mybb->input['exporttype']."_message"10)."\";");
        
$ids .= ",'$message[pmid]'";
    }
    
$query $db->query("SELECT css FROM ".TABLE_PREFIX."themes WHERE tid='$theme[tid]'");
    
$css $db->result($query0);

    eval(
"\$archived = \"".$templates->get("private_archive_".$mybb->input['exporttype'], 10)."\";");
    if(
$mybb->input['deletepms'] == "yes")
    { 
// delete the archived pms
        
$db->query("DELETE FROM ".TABLE_PREFIX."privatemessages WHERE pmid IN (''$ids)");
    }
    if(
$mybb->input['exporttype'] == "html")
    {
        
$filename "pm-archive.html";
        
$contenttype "text/html";
    }
    elseif(
$mybb->input['exporttype'] == "csv")
    {
        
$filename "pm-archive.csv";
        
$contenttype "application/octet-stream";
    }
    else
    {
        
$filename "pm-archive.txt";
        
$contenttype "text/plain";
    }
    
$archived ereg_replace("\\\'","'",$archived);
    
header("Content-Disposition: attachment; filename=$filename");
    
header("Content-type: $contenttype");
    
$plugins->run_hooks("private_do_export_end");
    if(
$mybb->input['exporttype'] == "html")
    {
           
outputpage($archived);
    }
    else
    {
         echo 
$archived;
    }


Gruß,
Michael
[Bild: banner.png]
Support erfolgt NUR im Forum!
Bitte gelöste Themen als "erledigt" markieren.
Beiträge mit mangelhafter Rechtschreibung/Grammatik werden kommentarlos gelöscht.
#3
Danke für den Patch,
noch ein Fehler : (?)
wenn ich beim Exportieren angebe :Nachrichten "älter als 30 Tage"
bekomme ich ein Ergebnis als hätte ich : "jünger als 30 Tage"
eingegeben.
Auch Zahnschmerzen tun weh ... ( jetzt nicht mehr)


Möglicherweise verwandte Themen…
Thema Verfasser Antworten Ansichten Letzter Beitrag
  ACP Theme Exportieren toto 4 3.251 01.05.2005, 16:46
Letzter Beitrag: toto