Zeile 59 | Zeile 59 |
---|
$query = $db->simple_select("maillogs", "*", "mid='".$mybb->get_input('mid', MyBB::INPUT_INT)."'"); $log = $db->fetch_array($query);
|
$query = $db->simple_select("maillogs", "*", "mid='".$mybb->get_input('mid', MyBB::INPUT_INT)."'"); $log = $db->fetch_array($query);
|
if(!$log['mid'])
| if(!$log)
|
{ exit; }
| { exit; }
|
Zeile 119 | Zeile 119 |
---|
if(!$mybb->input['action']) {
|
if(!$mybb->input['action']) {
|
$query = $db->simple_select("maillogs l", "COUNT(l.mid) as logs", "1=1 {$additional_sql_criteria}");
| $query = $db->simple_select("maillogs l", "COUNT(l.mid) as logs");
|
$total_rows = $db->fetch_field($query, "logs");
if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1) { $mybb->settings['threadsperpage'] = 20; }
|
$total_rows = $db->fetch_field($query, "logs");
if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1) { $mybb->settings['threadsperpage'] = 20; }
|
|
|
$per_page = $mybb->settings['threadsperpage'];
if(!$per_page)
|
$per_page = $mybb->settings['threadsperpage'];
if(!$per_page)
|
{
| {
|
$per_page = 20;
|
$per_page = 20;
|
}
if($mybb->input['page'] && $mybb->input['page'] > 1)
| }
$mybb->input['page'] = $mybb->get_input('page', MyBB::INPUT_INT); if($mybb->input['page'] > 1)
|
{
|
{
|
$mybb->input['page'] = $mybb->get_input('page', MyBB::INPUT_INT);
| |
$start = ($mybb->input['page']*$per_page)-$per_page; $pages = ceil($total_rows / $per_page); if($mybb->input['page'] > $pages)
| $start = ($mybb->input['page']*$per_page)-$per_page; $pages = ceil($total_rows / $per_page); if($mybb->input['page'] > $pages)
|
Zeile 144 | Zeile 144 |
---|
$mybb->input['page'] = 1; $start = 0; }
|
$mybb->input['page'] = 1; $start = 0; }
|
}
| }
|
else { $mybb->input['page'] = 1; $start = 0; }
|
else { $mybb->input['page'] = 1; $start = 0; }
|
|
|
$additional_criteria = array();
|
$additional_criteria = array();
|
|
|
$plugins->run_hooks("admin_tools_maillogs_start");
|
$plugins->run_hooks("admin_tools_maillogs_start");
|
|
|
// Filter form was submitted - play around with the values if($mybb->request_method == "post") {
| // Filter form was submitted - play around with the values if($mybb->request_method == "post") {
|
Zeile 163 | Zeile 163 |
---|
$mybb->input['fromname'] = $mybb->input['from_value']; } else if($mybb->input['from_type'] == "email")
|
$mybb->input['fromname'] = $mybb->input['from_value']; } else if($mybb->input['from_type'] == "email")
|
{
| {
|
$mybb->input['fromemail'] = $mybb->input['from_value'];
|
$mybb->input['fromemail'] = $mybb->input['from_value'];
|
}
| }
|
if($mybb->input['to_type'] == "user") { $mybb->input['toname'] = $mybb->input['to_value'];
|
if($mybb->input['to_type'] == "user") { $mybb->input['toname'] = $mybb->input['to_value'];
|
}
| }
|
else if($mybb->input['to_type'] == "email") { $mybb->input['toemail'] = $mybb->input['to_value']; } }
|
else if($mybb->input['to_type'] == "email") { $mybb->input['toemail'] = $mybb->input['to_value']; } }
|
|
|
$touid = $mybb->get_input('touid', MyBB::INPUT_INT);
|
$touid = $mybb->get_input('touid', MyBB::INPUT_INT);
|
$toname = $db->escape_string($mybb->input['toname']); $toemail = $db->escape_string_like($mybb->input['toemail']);
| $toname = $db->escape_string($mybb->get_input('toname')); $toemail = $db->escape_string_like($mybb->get_input('toemail'));
|
$fromuid = $mybb->get_input('fromuid', MyBB::INPUT_INT);
|
$fromuid = $mybb->get_input('fromuid', MyBB::INPUT_INT);
|
$fromemail = $db->escape_string_like($mybb->input['fromemail']);
$subject = $db->escape_string_like($mybb->input['subject']);
| $fromemail = $db->escape_string_like($mybb->get_input('fromemail'));
$subject = $db->escape_string_like($mybb->get_input('subject'));
|
// Begin criteria filtering
|
// Begin criteria filtering
|
if($mybb->input['subject']) {
| $additional_sql_criteria = ''; if(!empty($mybb->input['subject'])) {
|
$additional_sql_criteria .= " AND l.subject LIKE '%{$subject}%'"; $additional_criteria[] = "subject=".urlencode($mybb->input['subject']);
|
$additional_sql_criteria .= " AND l.subject LIKE '%{$subject}%'"; $additional_criteria[] = "subject=".urlencode($mybb->input['subject']);
|
}
| }
|
|
|
if($mybb->input['fromuid'])
| $from_filter = ''; if(!empty($mybb->input['fromuid']))
|
{ $query = $db->simple_select("users", "uid, username", "uid = '{$fromuid}'"); $user = $db->fetch_array($query);
|
{ $query = $db->simple_select("users", "uid, username", "uid = '{$fromuid}'"); $user = $db->fetch_array($query);
|
$from_filter = $user['username'];
| $from_filter = $user['username'];
|
$additional_sql_criteria .= " AND l.fromuid = '{$fromuid}'"; $additional_criteria[] = "fromuid={$fromuid}"; }
|
$additional_sql_criteria .= " AND l.fromuid = '{$fromuid}'"; $additional_criteria[] = "fromuid={$fromuid}"; }
|
else if($mybb->input['fromname'])
| else if(!empty($mybb->input['fromname']))
|
{ $user = get_user_by_username($mybb->input['fromname'], array('fields' => 'uid, username'));
|
{ $user = get_user_by_username($mybb->input['fromname'], array('fields' => 'uid, username'));
|
$from_filter = $user['username'];
| |
|
|
if(!$user['uid'])
| if(!$user)
|
{ flash_message($lang->error_invalid_user, 'error'); admin_redirect("index.php?module=tools-maillogs"); }
|
{ flash_message($lang->error_invalid_user, 'error'); admin_redirect("index.php?module=tools-maillogs"); }
|
| $from_filter = $user['username'];
|
$additional_sql_criteria .= "AND l.fromuid = '{$user['uid']}'"; $additional_criteria[] = "fromuid={$user['uid']}"; }
|
$additional_sql_criteria .= "AND l.fromuid = '{$user['uid']}'"; $additional_criteria[] = "fromuid={$user['uid']}"; }
|
if($mybb->input['fromemail'])
| else if(!empty($mybb->input['fromemail']))
|
{ $additional_sql_criteria .= " AND l.fromemail LIKE '%{$fromemail}%'"; $additional_criteria[] = "fromemail=".urlencode($mybb->input['fromemail']); $from_filter = $mybb->input['fromemail'];
|
{ $additional_sql_criteria .= " AND l.fromemail LIKE '%{$fromemail}%'"; $additional_criteria[] = "fromemail=".urlencode($mybb->input['fromemail']); $from_filter = $mybb->input['fromemail'];
|
}
| }
|
|
|
if($mybb->input['touid'])
| $to_filter = ''; if(!empty($mybb->input['touid']))
|
{ $query = $db->simple_select("users", "uid, username", "uid = '{$touid}'"); $user = $db->fetch_array($query);
|
{ $query = $db->simple_select("users", "uid, username", "uid = '{$touid}'"); $user = $db->fetch_array($query);
|
$to_filter = $user['username'];
| $to_filter = $user['username'];
|
$additional_sql_criteria .= " AND l.touid = '{$touid}'"; $additional_criteria[] = "touid={$touid}"; }
|
$additional_sql_criteria .= " AND l.touid = '{$touid}'"; $additional_criteria[] = "touid={$touid}"; }
|
else if($mybb->input['toname'])
| else if(!empty($mybb->input['toname']))
|
{ $user = get_user_by_username($toname, array('fields' => 'username'));
|
{ $user = get_user_by_username($toname, array('fields' => 'username'));
|
$to_filter = $user['username'];
| |
|
|
if(!$user['uid'])
| if(!$user)
|
{ flash_message($lang->error_invalid_user, 'error'); admin_redirect("index.php?module=tools-maillogs");
|
{ flash_message($lang->error_invalid_user, 'error'); admin_redirect("index.php?module=tools-maillogs");
|
}
| }
$to_filter = $user['username'];
|
$additional_sql_criteria .= "AND l.touid='{$user['uid']}'"; $additional_criteria[] = "touid={$user['uid']}";
|
$additional_sql_criteria .= "AND l.touid='{$user['uid']}'"; $additional_criteria[] = "touid={$user['uid']}";
|
}
if($mybb->input['toemail']) {
| } else if(!empty($mybb->input['toemail'])) {
|
$additional_sql_criteria .= " AND l.toemail LIKE '%{$toemail}%'"; $additional_criteria[] = "toemail=".urlencode($mybb->input['toemail']); $to_filter = $mybb->input['toemail'];
| $additional_sql_criteria .= " AND l.toemail LIKE '%{$toemail}%'"; $additional_criteria[] = "toemail=".urlencode($mybb->input['toemail']); $to_filter = $mybb->input['toemail'];
|
Zeile 258 | Zeile 261 |
---|
if(!empty($additional_criteria)) { $additional_criteria = "&".implode("&", $additional_criteria);
|
if(!empty($additional_criteria)) { $additional_criteria = "&".implode("&", $additional_criteria);
|
}
| }
|
else { $additional_criteria = '';
| else { $additional_criteria = '';
|
Zeile 271 | Zeile 274 |
---|
'link' => "index.php?module=tools-maillogs", 'description' => $lang->user_email_log_desc );
|
'link' => "index.php?module=tools-maillogs", 'description' => $lang->user_email_log_desc );
|
|
|
$page->output_nav_tabs($sub_tabs, 'maillogs');
$form = new Form("index.php?module=tools-maillogs&action=prune", "post");
| $page->output_nav_tabs($sub_tabs, 'maillogs');
$form = new Form("index.php?module=tools-maillogs&action=prune", "post");
|
Zeile 300 | Zeile 303 |
---|
$log['subject'] = htmlspecialchars_uni($log['subject']); $log['dateline'] = my_date('relative', $log['dateline']);
|
$log['subject'] = htmlspecialchars_uni($log['subject']); $log['dateline'] = my_date('relative', $log['dateline']);
|
if($log['type'] == 2) {
| $plugins->run_hooks("admin_tools_maillogs_log");
if($log['type'] == 1) { $table->construct_cell("<img src=\"styles/{$page->style}/images/icons/maillogs_user.png\" title=\"{$lang->email_sent_to_user}\" alt=\"\" />", array("width" => 1)); $table->construct_cell("<a href=\"javascript:MyBB.popupWindow('index.php?module=tools-maillogs&action=view&mid={$log['mid']}', null, true);\">{$log['subject']}</a>"); } elseif($log['type'] == 2) {
|
if($log['thread_subject']) { $log['thread_subject'] = htmlspecialchars_uni($log['thread_subject']); $thread_link = "<a href=\"../".get_thread_link($log['tid'])."\">".$log['thread_subject']."</a>";
|
if($log['thread_subject']) { $log['thread_subject'] = htmlspecialchars_uni($log['thread_subject']); $thread_link = "<a href=\"../".get_thread_link($log['tid'])."\">".$log['thread_subject']."</a>";
|
} else
| } else
|
{ $thread_link = $lang->deleted;
|
{ $thread_link = $lang->deleted;
|
}
| }
|
$table->construct_cell("<img src=\"styles/{$page->style}/images/icons/maillogs_thread.png\" title=\"{$lang->sent_using_send_thread_feature}\" alt=\"\" />", array("width" => 1)); $table->construct_cell("<a href=\"javascript:MyBB.popupWindow('index.php?module=tools-maillogs&action=view&mid={$log['mid']}', null, true);\">{$log['subject']}</a><br /><small>{$lang->thread} {$thread_link}</small>");
|
$table->construct_cell("<img src=\"styles/{$page->style}/images/icons/maillogs_thread.png\" title=\"{$lang->sent_using_send_thread_feature}\" alt=\"\" />", array("width" => 1)); $table->construct_cell("<a href=\"javascript:MyBB.popupWindow('index.php?module=tools-maillogs&action=view&mid={$log['mid']}', null, true);\">{$log['subject']}</a><br /><small>{$lang->thread} {$thread_link}</small>");
|
if($log['fromuid'] > 0) { $find_from = "<div class=\"float_right\"><a href=\"index.php?module=tools-maillogs&fromuid={$log['fromuid']}\"><img src=\"styles/{$page->style}/images/icons/find.png\" title=\"{$lang->find_emails_by_user}\" alt=\"{$lang->find}\" /></a></div>"; }
if(!$log['from_username'] && $log['fromuid'] > 0) { $table->construct_cell("{$find_from}<div>{$lang->deleted_user}</div>"); } elseif($log['fromuid'] == 0) { $log['fromemail'] = htmlspecialchars_uni($log['fromemail']); $table->construct_cell("{$find_from}<div>{$log['fromemail']}</div>"); } else { $table->construct_cell("{$find_from}<div><a href=\"../".get_profile_link($log['fromuid'])."\">{$log['from_username']}</a></div>"); }
$log['toemail'] = htmlspecialchars_uni($log['toemail']); $table->construct_cell($log['toemail']); } elseif($log['type'] == 1) { $table->construct_cell("<img src=\"styles/{$page->style}/images/icons/maillogs_user.png\" title=\"{$lang->email_sent_to_user}\" alt=\"\" />", array("width" => 1)); $table->construct_cell("<a href=\"javascript:MyBB.popupWindow('index.php?module=tools-maillogs&action=view&mid={$log['mid']}', null, true);\">{$log['subject']}</a>");
if($log['fromuid'] > 0) { $find_from = "<div class=\"float_right\"><a href=\"index.php?module=tools-maillogs&fromuid={$log['fromuid']}\"><img src=\"styles/{$page->style}/images/icons/find.png\" title=\"{$lang->find_emails_by_user}\" alt=\"{$lang->find}\" /></a></div>"; }
if(!$log['from_username'] && $log['fromuid'] > 0) { $table->construct_cell("{$find_from}<div>{$lang->deleted_user}</div>"); } elseif($log['fromuid'] == 0) { $log['fromemail'] = htmlspecialchars_uni($log['fromemail']); $table->construct_cell("{$find_from}<div>{$log['fromemail']}</div>"); } else { $table->construct_cell("{$find_from}<div><a href=\"../".get_profile_link($log['fromuid'])."\">{$log['from_username']}</a></div>"); }
$find_to = "<div class=\"float_right\"><a href=\"index.php?module=tools-maillogs&touid={$log['touid']}\"><img src=\"styles/{$page->style}/images/icons/find.png\" title=\"{$lang->find_emails_to_user}\" alt=\"{$lang->find}\" /></a></div>"; if(!$log['to_username']) { $table->construct_cell("{$find_to}<div>{$lang->deleted_user}</div>"); } else { $table->construct_cell("{$find_to}<div><a href=\"../".get_profile_link($log['touid'])."\">{$log['to_username']}</a></div>"); }
| |
} elseif($log['type'] == 3) { $table->construct_cell("<img src=\"styles/{$page->style}/images/icons/maillogs_contact.png\" title=\"{$lang->email_sent_using_contact_form}\" alt=\"\" />", array("width" => 1)); $table->construct_cell("<a href=\"javascript:MyBB.popupWindow('index.php?module=tools-maillogs&action=view&mid={$log['mid']}', null, true);\">{$log['subject']}</a>");
|
} elseif($log['type'] == 3) { $table->construct_cell("<img src=\"styles/{$page->style}/images/icons/maillogs_contact.png\" title=\"{$lang->email_sent_using_contact_form}\" alt=\"\" />", array("width" => 1)); $table->construct_cell("<a href=\"javascript:MyBB.popupWindow('index.php?module=tools-maillogs&action=view&mid={$log['mid']}', null, true);\">{$log['subject']}</a>");
|
| } else { $table->construct_cell("<img src=\"styles/{$page->style}/images/icons/default.png\" title=\"{$lang->email}\" alt=\"\" />", array("width" => 1)); $table->construct_cell("<a href=\"javascript:MyBB.popupWindow('index.php?module=tools-maillogs&action=view&mid={$log['mid']}', null, true);\">{$log['subject']}</a>"); }
if($log['fromuid'] > 0) { $log['find_from'] = "<div class=\"float_right\"><a href=\"index.php?module=tools-maillogs&fromuid={$log['fromuid']}\"><img src=\"styles/{$page->style}/images/icons/find.png\" title=\"{$lang->find_emails_by_user}\" alt=\"{$lang->find}\" /></a></div>"; } else { $log['find_from'] = ''; }
if(!$log['from_username'] && $log['fromuid'] > 0) { $table->construct_cell("{$log['find_from']}<div>{$lang->deleted_user}</div>"); } elseif($log['fromuid'] == 0) { $log['fromemail'] = htmlspecialchars_uni($log['fromemail']); $table->construct_cell("{$log['find_from']}<div>{$log['fromemail']}</div>"); } else { $table->construct_cell("{$log['find_from']}<div><a href=\"../".get_profile_link($log['fromuid'])."\">{$log['from_username']}</a></div>"); }
|
|
|
if($log['fromuid'] > 0) { $find_from = "<div class=\"float_right\"><a href=\"index.php?module=tools-maillogs&fromuid={$log['fromuid']}\"><img src=\"styles/{$page->style}/images/icons/find.png\" title=\"{$lang->find_emails_by_user}\" alt=\"{$lang->find}\" /></a></div>"; }
if(!$log['from_username'] && $log['fromuid'] > 0) { $table->construct_cell("{$find_from}<div>{$lang->deleted_user}</div>"); } elseif($log['fromuid'] == 0) { $log['fromemail'] = htmlspecialchars_uni($log['fromemail']); $table->construct_cell("{$find_from}<div>{$log['fromemail']}</div>"); } else { $table->construct_cell("{$find_from}<div><a href=\"../".get_profile_link($log['fromuid'])."\">{$log['from_username']}</a></div>"); }
| if($log['touid'] > 0) { $log['find_to'] = "<div class=\"float_right\"><a href=\"index.php?module=tools-maillogs&touid={$log['touid']}\"><img src=\"styles/{$page->style}/images/icons/find.png\" title=\"{$lang->find_emails_to_user}\" alt=\"{$lang->find}\" /></a></div>"; } else { $log['find_to'] = ''; }
|
|
|
| if(!$log['to_username'] && $log['touid'] > 0) { $table->construct_cell("{$log['find_to']}<div>{$lang->deleted_user}</div>"); } elseif($log['touid'] == 0) {
|
$log['toemail'] = htmlspecialchars_uni($log['toemail']);
|
$log['toemail'] = htmlspecialchars_uni($log['toemail']);
|
$table->construct_cell($log['toemail']);
| $table->construct_cell("{$log['find_to']}<div>{$log['toemail']}</div>"); } else { $table->construct_cell("{$log['find_to']}<div><a href=\"../".get_profile_link($log['touid'])."\">{$log['to_username']}</a></div>");
|
}
$table->construct_cell($log['dateline'], array("class" => "align_center"));
| }
$table->construct_cell($log['dateline'], array("class" => "align_center"));
|
Zeile 427 | Zeile 410 |
---|
"user" => $lang->username_is, "email" => $lang->email_contains );
|
"user" => $lang->username_is, "email" => $lang->email_contains );
|
$form_container->output_row($lang->subject_contains, "", $form->generate_text_box('subject', $mybb->input['subject'], array('id' => 'subject')), 'subject'); if($from_username)
| $form_container->output_row($lang->subject_contains, "", $form->generate_text_box('subject', $mybb->get_input('subject'), array('id' => 'subject')), 'subject'); $from_type = ''; if($mybb->get_input('fromname'))
|
{ $from_type = "user"; }
|
{ $from_type = "user"; }
|
else if($mybb->input['fromemail'])
| else if($mybb->get_input('fromemail'))
|
{ $from_type = "email"; } $form_container->output_row($lang->from, "", $form->generate_select_box('from_type', $user_email, $from_type)." ".$form->generate_text_box('from_value', htmlspecialchars_uni($from_filter), array('id' => 'from_value')), 'from_value');
|
{ $from_type = "email"; } $form_container->output_row($lang->from, "", $form->generate_select_box('from_type', $user_email, $from_type)." ".$form->generate_text_box('from_value', htmlspecialchars_uni($from_filter), array('id' => 'from_value')), 'from_value');
|
if($to_username)
| $to_type = ''; if($mybb->get_input('toname'))
|
{ $to_type = "user"; }
|
{ $to_type = "user"; }
|
else if($mybb->input['toemail'])
| else if($mybb->get_input('toemail'))
|
{ $to_type = "email"; }
| { $to_type = "email"; }
|