// user-export
if($mybb->input['action'] == "export_user")
{
$page->add_breadcrumb_item("Benuter-Export Vorschau");
$page->output_header("Benuter-Export");
$sub_tabs['export_user'] = array(
'title' => "Benuter-Export",
'link' => "index.php?module=user-users&action=export_user&uid={$mybb->input['uid']}",
'description' => "Hier eine Zusammenstellung aller erforderlichen Benutzerdaten für den Export."
);
$page->output_nav_tabs($sub_tabs, 'export_user');
$usergroups = array();
#$query = $db->simple_select("users", "*", "uid='{$mybb->input['uid']}'", array('limit' => 1));
$query = $db->query("
SELECT u.*, u.uid, u.username, u.usergroup, u.displaygroup, u.additionalgroups, u.avatar, g.title as usergrouptitle, uf.*
FROM ".TABLE_PREFIX."users u
LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup)
LEFT JOIN ".TABLE_PREFIX."userfields uf ON (u.uid = uf.ufid)
WHERE u.uid='{$mybb->input['uid']}'
LIMIT 1
");
$user = $db->fetch_array($query);
$allgroups = $user['additionalgroups'];
$alle = explode (',',$allgroups);
if($user['uid'] || $mybb->input['uid'] == $user['uid'])
{
$totalgroups = count($alle);
for($counter = 0; $counter < $totalgroups; $counter++)
{
$g = $alle[$counter];
$query = $db->query("select gid, title FROM ".TABLE_PREFIX."usergroups WHERE gid='$g'");
$fetch = $db->fetch_array($query);
$additionalgroups .= $coma.$fetch['title'];
$coma = ", ";
}
}
$user['username'] = htmlspecialchars_uni($user['username']);
$username = htmlspecialchars_uni($user['username']);
log_admin_action($user['uid'], htmlspecialchars_uni($user['username']));
$table = new Table;
$table->construct_header("Benutzer-Daten", array('colspan' => '2'));
$table->construct_cell("<strong>Benutzername:</strong> ", array('width' =>'200'));
$table->construct_cell($user['username']);
$table->construct_row();
if(empty($user['birthday']))
{
$user['birthday'] = $lang->unknown;
}
else
{
$membday = explode("-", $user['birthday']);
if($user['birthdayprivacy'] != 'none')
{
if($membday[0] && $membday[1] && $membday[2])
{
$lang->membdayage = $lang->sprintf(" ({1} Jahre alt)", get_age($user['birthday']));
$bdayformat = fix_mktime($mybb->settings['dateformat'], $membday[2]);
$membday = mktime(0, 0, 0, $membday[1], $membday[0], $membday[2]);
$membday = date($bdayformat, $membday);
$membdayage = "({1} Jahre alt)";
}
elseif($membday[2])
{
$membday = mktime(0, 0, 0, 1, 1, $membday[2]);
$membday = date("Y", $membday);
$membdayage = '';
}
else
{
$membday = mktime(0, 0, 0, $membday[1], $membday[0], 0);
$membday = date("F j", $membday);
$membdayage = '';
}
}
if($user['birthdayprivacy'] == 'age')
{
$membday = "Versteckt";
}
else if($user['birthdayprivacy'] == 'none')
{
$membday = "Versteckt";
$membdayage = '';
}
}
$table->construct_cell("<strong>{$lang->birthday}:</strong> ", array('width' =>'200'));
$table->construct_cell($membday.$lang->membdayage);
$table->construct_row();
$reg_date = my_date('relative', $user['regdate']);
if($user['dst'] == 1)
{
$timezone = (float)$user['timezone']+1;
}
else
{
$timezone = (float)$user['timezone'];
}
$local_date = gmdate($mybb->settings['dateformat'], TIME_NOW + ($timezone * 3600));
$local_time = gmdate($mybb->settings['timeformat'], TIME_NOW + ($timezone * 3600));
$localtime = $lang->sprintf($lang->local_time_format, $local_date, $local_time);
$table->construct_cell("<strong>{$lang->registration_date}:</strong> ", array('width' =>'200'));
$table->construct_cell($reg_date);
$table->construct_row();
if(empty($user['lastactive']))
{
$last_active = $lang->unknown;
}
else
{
$last_active = gmdate($mybb->settings['dateformat'], $user['lastactive']);
$last_active_time = gmdate($mybb->settings['timeformat'], $user['lastactive']);
}
$table->construct_cell("<strong>{$lang->last_active}:</strong> ", array('width' =>'200'));
$table->construct_cell("{$last_active}, {$last_active_time}");
$table->construct_row();
if(empty($user['website']))
{
$user['website'] = $lang->unknown;
}
else
{
$user['website'] = htmlspecialchars_uni($user['website']);
}
$table->construct_cell("<strong>Webseite:</strong> ", array('width' =>'200'));
$table->construct_cell($user['website']);
$table->construct_row();
if(empty($user['email']))
{
$user['email'] = $lang->unknown;
}
else
{
$user['email'] = htmlspecialchars_uni($user['email']);
}
$table->construct_cell("<strong>E-Mail:</strong> ", array('width' =>'200'));
$table->construct_cell($user['email']);
$table->construct_row();
if(empty($user['icq']))
{
$user['icq'] = $lang->unknown;
}
else
{
$user['icq'] = htmlspecialchars_uni($user['icq']);
}
$table->construct_cell("<strong>ICQ-Nummer:</strong> ", array('width' =>'200'));
$table->construct_cell($user['icq']);
$table->construct_row();
if(empty($user['aim']))
{
$user['aim'] = $lang->unknown;
}
else
{
$user['aim'] = htmlspecialchars_uni($user['aim']);
}
$table->construct_cell("<strong>AIM-ID:</strong> ", array('width' =>'200'));
$table->construct_cell($user['aim']);
$table->construct_row();
if(empty($user['yahoo']))
{
$user['yahoo'] = $lang->unknown;
}
else
{
$user['yahoo'] = htmlspecialchars_uni($user['yahoo']);
}
$table->construct_cell("<strong>Yahoo-ID:</strong> ", array('width' =>'200'));
$table->construct_cell($user['yahoo']);
$table->construct_row();
if(empty($user['skype']))
{
$user['skype'] = $lang->unknown;
}
else
{
$user['skype'] = htmlspecialchars_uni($user['skype']);
}
$table->construct_cell("<strong>Skype-ID:</strong> ", array('width' =>'200'));
$table->construct_cell($user['skype']);
$table->construct_row();
if(empty($user['google']))
{
$user['google'] = $lang->unknown;
}
else
{
$user['google'] = htmlspecialchars_uni($user['google']);
}
$table->construct_cell("<strong>Google-Hangouts-ID:</strong> ", array('width' =>'200'));
$table->construct_cell($user['google']);
$table->construct_row();
if(empty($user['lastip']))
{
$user['lastip'] = $lang->unknown;
}
else
{
$user['lastip'] = my_inet_ntop($db->unescape_binary($user['lastip']));
}
$table->construct_cell("<strong>{$lang->last_known_ip}:</strong> ", array('width' =>'200'));
$table->construct_cell($user['lastip']);
$table->construct_row();
if(empty($user['regip']))
{
$user['regip'] = $lang->unknown;
}
else
{
$user['regip'] = my_inet_ntop($db->unescape_binary($user['regip']));
}
$table->construct_cell("<strong>{$lang->registration_ip}:</strong> ", array('width' =>'200'));
$table->construct_cell($user['regip']);
$table->construct_row();
$table->construct_cell("<strong>{$lang->thread_count}:</strong> ", array('width' =>'200'));
$table->construct_cell($user['threadnum']);
$table->construct_row();
$table->construct_cell("<strong>{$lang->post_count}:</strong> ", array('width' =>'200'));
$table->construct_cell($user['postnum']);
$table->construct_row();
$table->construct_cell("<strong>{$lang->primary_user_group}:</strong> ", array('width' =>'200'));
$table->construct_cell(htmlspecialchars_uni($user['usergrouptitle']));
$table->construct_row();
$table->construct_cell("<strong>{$lang->additional_groups}:</strong> ", array('width' =>'200'));
$table->construct_cell(htmlspecialchars_uni($additionalgroups));
$table->construct_row();
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;
if(empty($user['signature']) && ($user['suspendsignature'] == 0 || $user['suspendsigtime'] < TIME_NOW))
{
$user['signature'] = $lang->unknown;
}
else
{
$sig_parser = array(
"allow_html" => 0,
"allow_mycode" => 0,
"allow_smilies" => 0,
"allow_imgcode" => 0,
//"me_username" => $me_username,
"filter_badwords" => 1
);
$user['signature'] = $parser->parse_message($user['signature'], $sig_parser);
}
$table->construct_cell("<strong>{$lang->signature}:</strong> ", array('width' =>'200'));
$table->construct_cell($user['signature']);
$table->construct_row();
if($user['timeonline'] > 0)
{
$timeonline = nice_time($user['timeonline']);
}
$table->construct_cell("<strong>Gesamte Onlinezeit:</strong> ", array('width' =>'200'));
$table->construct_cell($timeonline);
$table->construct_row();
if(empty($user['usertitle']))
{
$user['usertitle'] = $lang->unknown;
}
else
{
$user['usertitle'] = htmlspecialchars_decode($user['usertitle']);
}
$table->construct_cell("<strong>{$lang->custom_user_title}:</strong> ", array('width' =>'200'));
$table->construct_cell($user['usertitle']);
$table->construct_row();
if($user['away'] == 0)
{
$user['away'] = $lang->im_here;
}
if($user['away'] == 1 && $mybb->settings['allowaway'] != 0)
{
$user['away'] = $lang->im_away."\r\n";
$awaydate = my_date($mybb->settings['dateformat'], $user['awaydate']);
if(!empty($user['awayreason']))
{
$reason = $parser->parse_badwords($user['awayreason']);
$awayreason = htmlspecialchars_uni($reason);
$user['away'] .= $lang->away_reason . " " .$awayreason."\r\n";
}
else
{
$awayreason = $lang->away_no_reason;
}
if($user['returndate'] == '')
{
$returndate = $lang->unknown;
}
else
{
$returnhome = explode("-", $user['returndate']);
if($returnhome[2] >= 2038)
{
require_once MYBB_ROOT."inc/functions_time.php";
$returnmkdate = adodb_mktime(0, 0, 0, $returnhome[1], $returnhome[0], $returnhome[2]);
$returndate = my_date($mybb->settings['dateformat'], $returnmkdate, "", 1, true);
$user['away'] .= $lang->return_date . " " .$returndate;
}
else
{
$returnmkdate = mktime(0, 0, 0, $returnhome[1], $returnhome[0], $returnhome[2]);
$returndate = my_date($mybb->settings['dateformat'], $returnmkdate);
$user['away'] .= $lang->return_date . " " .$returndate;
}
if($returnmkdate < TIME_NOW)
{
$db->update_query('users', array('away' => '0', 'awaydate' => '0', 'returndate' => '', 'awayreason' => ''), 'uid=\''.(int)$user['uid'].'\'');
$user['away'] = 0;
}
}
}
$table->construct_cell("<strong>{$lang->away_information}:</strong> ", array('width' =>'200'));
$table->construct_cell(nl2br($user['away']));
$table->construct_row();
$filds = array(
"fid1: ".$user['fid1'],
"fid2: ".$user['fid2'],
"fid3: ".$user['fid3'],
"fid4: ".$user['fid4'],
"fid5: ".$user['fid5'],
"fid6: ".$user['fid6']
);
$userfields = implode("<br />\r\n", $filds);
$table->construct_cell("<strong>Profilfeld(er):</strong> ", array('width' =>'200'));
$table->construct_cell($userfields);
$table->construct_row();
$exportuser = $user['username'].".txt";
$table->construct_cell("<strong>Diese Daten als txt downloaden:</strong><br />(Rechtsklick->Speichern unter)", array('width' =>'200'));
#$filename = $exportuser;
$user = array(
"Benutzername: ".$user['username']."\r\n",
"Geburtsdatum: ".$membday.$lang->membdayage."\r\n",
"Registrierungsdatum: ".$reg_date."\r\n",
"Letzte Aktivität: ".$last_active.", ".$last_active_time."\r\n",
"Gesamte Onlinezeit: ".$timeonline."\r\n",
"Webseite: ".$user['website']."\r\n",
"Email: ".$user['email']."\r\n",
"ICQ-ID: ".$user['icq']."\r\n",
"AIM-ID: ".$user['aim']."\r\n",
"Yahoo-ID: ".$user['yahoo']."\r\n",
"Skype-ID: ".$user['skype']."\r\n",
"Google-Hangouts-ID: ".$user['google']."\r\n",
"Registrierungs-IP: ".$user['regip']."\r\n",
"Letzte bekannte IP: ".$user['lastip']."\r\n",
"Themenanzahl: ".$user['threadnum']."\r\n",
"Beitragsanzahl: ".$user['postnum']."\r\n",
"Primäre Benutzergruppe: ".$user['usergrouptitle']."\r\n",
"Sekundäre Gruppen: ".$additionalgroups."\r\n",
"Signatur: ".$user['signature'] = str_replace("<br />", "", $user['signature'])."\r\n",
"Eigener Benutzertitel: ".$user['usertitle']."\r\n",
"Abwesenheitsinformation: ".$user['away']."\r\n",
"Profilfeld(er): ".$userfields = str_replace("<br />", "", $userfields)
);
$ordner = "userdaten/".$exportuser;
$fp = @fopen($ordner, "w+");
foreach($user as $values)
{
$suchumlaut = array("Ä","ä"," Ö","ö","Ü","&Üuml;","&","ß","æ");
$ersatzumlaut = array("Ä","ä","Ö","ö","Ü","ü","&","ß","æ");
$values = str_replace($suchumlaut, $ersatzumlaut, $values);
fwrite($fp, $values."\r\n");
}
fclose($fp);
$table->construct_cell("<a href=\"userdaten/{$exportuser}\" title=\"\">Datei downloaden</a>");
$table->construct_row();
$table->output("Benutzer-Daten von ".$username);
$page->output_footer();
}
// user-export ende