Permalink
Browse files

- Added bans import function

- Fixes post stats in done.php
  • Loading branch information...
olimortimer
olimortimer committed Nov 12, 2011
1 parent ae2d486 commit 92ae7de835ca99a486657117b204d7487d0ba214
Showing with 44 additions and 2 deletions.
  1. +37 −0 SMF2/bans.php
  2. +7 −2 done.php
View
@@ -0,0 +1,37 @@
<?php
$result = $fdb->query('SELECT '.$fdb->prefix.'ban_items.id_ban, '.$fdb->prefix.'members.member_name,
ip_low1, ip_low2, ip_low3, ip_low4,
'.$fdb->prefix.'ban_items.email_address, '.$fdb->prefix.'ban_groups.reason, '.$fdb->prefix.'ban_groups.expire_time
FROM '.$fdb->prefix.'ban_items
INNER JOIN '.$fdb->prefix.'ban_groups ON '.$fdb->prefix.'ban_groups.id_ban_group = '.$fdb->prefix.'ban_items.id_ban_group
LEFT JOIN '.$fdb->prefix.'members ON '.$fdb->prefix.'members.id_member = '.$fdb->prefix.'ban_items.id_member
WHERE id_ban>'.$start.' ORDER BY id_ban LIMIT '.ceil($_SESSION['limit']/5)) or myerror("Unable to get bans", __FILE__, __LINE__, $fdb->error());
$last_id = -1;
while ($ob = $fdb->fetch_assoc($result))
{
$last_id = $ob['id_ban'];
$ob['member_name'] == '' ? $username = 'null' : $username = $ob['member_name'];
$ob['ip_low1'] == '0' ? $ip = 'null' : $ip = trim($ob['ip_low1'].'.'.$ob['ip_low2'].'.'.$ob['ip_low3'].'.'.$ob['ip_low4'],'.');
$ob['email_address'] == '' ? $email = 'null' : $email = $ob['email_address'];
$ob['reason'] == '' ? $message = 'null' : $message = $ob['reason'];
$ob['expire_time'] == '' ? $expire = 'null' : $expire = strtotime(date('Y-m-d', $ob['expire_time']).' GMT');
echo $ob['id_ban'].' - '.($username == 'null' ? ($email == 'null' ? $ip : $email) : $username)."<br>\n"; flush();
// Dataarray
$todb = array(
'username' => $username,
'ip' => $ip,
'email' => $email,
'message' => $message,
'expire' => $expire,
);
// Save data
insertdata('bans', $todb, __FILE__, __LINE__);
}
convredirect('id_ban', 'ban_items', $last_id);
View
@@ -185,17 +185,22 @@
// FluxBB
$rem = $name == 'Users' ? '-1' : ''; // Remove guest user
$res1 = $db->query('SELECT count(*)'.$rem.' AS count FROM '.$db->prefix.$name.'');
$res1_count = $db->result($res1, 0);
// Save FluxBB post count
if($name == 'Posts')
$_SESSION['posts'] = $db->result($res1, 0);
$_SESSION['posts'] = $res1_count;
// Converted forum
$rem = isset($tablerem[$name]) ? '-'.$tablerem[$name] : '';
$res2 = $fdb->query('SELECT count(*)'.$rem.' AS count FROM '.$fdb->prefix.$value.'');
// If no count, try the alternative converted forum table
if(!$res2) {
$res2 = $fdb->query('SELECT count(*)'.$rem.' AS count FROM '.$fdb->prefix.$tables_conv[$name].'');
}
// Line
echo "\n\t\t\t\t<br><b>".$name.":</b> ".@$db->result($res1, 0).' ('.@$fdb->result($res2, 0).')';
echo "\n\t\t\t\t<br><b>".$name.":</b> ".$res1_count.' ('.@$fdb->result($res2, 0).')';
}
}

0 comments on commit 92ae7de

Please sign in to comment.