Browse Source

Merge pull request #1 from marcusforsberg/button_strip-in-source

Hooks and button_strip stuffz
Marcus Forsberg 12 years ago
parent
commit
e97a0ce1e9

+ 8 - 0
Sources/BoardIndex.php

@@ -108,6 +108,14 @@ function BoardIndex()
 		$context['show_calendar'] = false;
 
 	$context['page_title'] = sprintf($txt['forum_index'], $context['forum_name']);
+	
+	// Mark read button
+	$context['mark_read_button'] = array(
+		'markread' => array('text' => 'mark_as_read', 'image' => 'markread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']),
+	);
+	
+	// Allow mods to add additional buttons here
+	call_integration_hook('integrate_mark_read_button', array(&$context['mark_read_button'])); 
 }
 
 /**

+ 8 - 0
Sources/Calendar.php

@@ -144,6 +144,14 @@ function CalendarMain()
 			'url' => $scripturl . '?action=calendar;viewweek;year=' . $context['current_year'] . ';month=' . $context['current_month'] . ';day=' . $context['current_day'],
 			'name' => $txt['calendar_week'] . ' ' . $context['calendar_grid_main']['week_number']
 		);
+		
+	// Build the calendar button array.
+	$context['calendar_buttons'] = array(
+		'post_event' => array('test' => 'can_post', 'text' => 'calendar_post_event', 'image' => 'calendarpe.png', 'lang' => true, 'url' => $scripturl . '?action=calendar;sa=post;month=' . $context['current_month'] . ';year=' . $context['current_year'] . ';' . $context['session_var'] . '=' . $context['session_id']),
+	);
+	
+	// Allow mods to add additional buttons here
+	call_integration_hook('integrate_calendar_buttons', array(&$context['calendar_buttons']));
 }
 
 /**

+ 52 - 0
Sources/Display.php

@@ -755,7 +755,23 @@ function Display()
 				'vote_button' => '<input type="' . ($pollinfo['max_votes'] > 1 ? 'checkbox' : 'radio') . '" name="options[]" id="options-' . $i . '" value="' . $i . '" class="input_' . ($pollinfo['max_votes'] > 1 ? 'check' : 'radio') . '" />'
 			);
 		}
+		
+		// Build the poll moderation button array.
+		$context['poll_buttons'] = array(
+			'vote' => array('test' => 'allow_return_vote', 'text' => 'poll_return_vote', 'image' => 'poll_options.png', 'lang' => true, 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start']),
+			'results' => array('test' => 'show_view_results_button', 'text' => 'poll_results', 'image' => 'poll_results.png', 'lang' => true, 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start'] . ';viewresults'),
+			'change_vote' => array('test' => 'allow_change_vote', 'text' => 'poll_change_vote', 'image' => 'poll_change_vote.png', 'lang' => true, 'url' => $scripturl . '?action=vote;topic=' . $context['current_topic'] . '.' . $context['start'] . ';poll=' . $context['poll']['id'] . ';' . $context['session_var'] . '=' . $context['session_id']),
+			'lock' => array('test' => 'allow_lock_poll', 'text' => (!$context['poll']['is_locked'] ? 'poll_lock' : 'poll_unlock'), 'image' => 'poll_lock.png', 'lang' => true, 'url' => $scripturl . '?action=lockvoting;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
+			'edit' => array('test' => 'allow_edit_poll', 'text' => 'poll_edit', 'image' => 'poll_edit.png', 'lang' => true, 'url' => $scripturl . '?action=editpoll;topic=' . $context['current_topic'] . '.' . $context['start']),
+			'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.png', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
+		);
+		
+		// Allow mods to add additional buttons here
+		call_integration_hook('integrate_poll_buttons', array(&$context['poll_buttons']));
 	}
+	
+	// Editing poll output, eh?
+	call_integration_hook('integrate_view_poll', array(&$context['poll']));
 
 	// Calculate the fastest way to get the messages!
 	$ascending = empty($options['view_newest_first']);
@@ -946,6 +962,9 @@ function Display()
 			foreach ($temp as $row)
 				$attachments[$row['id_msg']][] = $row;
 		}
+		
+		// Any custom stuff that might need to be loaded if there are messages to show
+		call_integration_hook('integrate_pre_message_load', array(&$messages));
 
 		// What?  It's not like it *couldn't* be only guests in this topic...
 		if (!empty($posters))
@@ -1097,6 +1116,36 @@ function Display()
 				$context['icons'][count($context['icons']) - 1]['is_last'] = true;
 		}
 	}
+	
+	// Build the normal button array.
+	$context['normal_buttons'] = array(
+		'reply' => array('test' => 'can_reply', 'text' => 'reply', 'image' => 'reply.png', 'lang' => true, 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message'], 'active' => true),
+		'add_poll' => array('test' => 'can_add_poll', 'text' => 'add_poll', 'image' => 'add_poll.png', 'lang' => true, 'url' => $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start']),
+		'notify' => array('test' => 'can_mark_notify', 'text' => $context['is_marked_notify'] ? 'unnotify' : 'notify', 'image' => ($context['is_marked_notify'] ? 'un' : '') . 'notify.png', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . '\');"', 'url' => $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
+		'mark_unread' => array('test' => 'can_mark_unread', 'text' => 'mark_unread', 'image' => 'markunread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
+		'send' => array('test' => 'can_send_topic', 'text' => 'send_topic', 'image' => 'sendtopic.png', 'lang' => true, 'url' => $scripturl . '?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.0'),
+		'print' => array('test' => 'can_print', 'text' => 'print', 'image' => 'print.png', 'lang' => true, 'custom' => 'rel="new_win nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'),
+	);
+
+	// Allow adding new buttons easily.
+	call_integration_hook('integrate_display_buttons', array(&$context['normal_buttons']));	
+	
+	// Build the mod button array
+	$context['mod_buttons'] = array(
+		'move' => array('test' => 'can_move', 'text' => 'move_topic', 'image' => 'admin_move.png', 'lang' => true, 'url' => $scripturl . '?action=movetopic;current_board=' . $context['current_board'] . ';topic=' . $context['current_topic'] . '.0'),
+		'delete' => array('test' => 'can_delete', 'text' => 'remove_topic', 'image' => 'admin_rem.png', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['are_sure_remove_topic'] . '\');"', 'url' => $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;' . $context['session_var'] . '=' . $context['session_id']),
+		'lock' => array('test' => 'can_lock', 'text' => empty($context['is_locked']) ? 'set_lock' : 'set_unlock', 'image' => 'admin_lock.png', 'lang' => true, 'url' => $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
+		'sticky' => array('test' => 'can_sticky', 'text' => empty($context['is_sticky']) ? 'set_sticky' : 'set_nonsticky', 'image' => 'admin_sticky.png', 'lang' => true, 'url' => $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
+		'merge' => array('test' => 'can_merge', 'text' => 'merge', 'image' => 'merge.png', 'lang' => true, 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']),
+		'calendar' => array('test' => 'calendar_post', 'text' => 'calendar_link', 'image' => 'linktocal.png', 'lang' => true, 'url' => $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0'),
+	);
+
+	// Restore topic. eh?  No monkey business.
+	if ($context['can_restore_topic'])
+		$context['mod_buttons'][] = array('text' => 'restore_topic', 'image' => '', 'lang' => true, 'url' => $scripturl . '?action=restoretopic;topics=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']);
+
+	// Allow adding new mod buttons easily.
+	call_integration_hook('integrate_mod_buttons', array(&$context['mod_buttons']));
 }
 
 /**
@@ -1225,6 +1274,9 @@ function prepareDisplayContext($reset = false)
 		$counter++;
 	else
 		$counter--;
+		
+	// Add new data to messages?
+	call_integration_hook('integrate_display_context', array(&$output));
 
 	return $output;
 }

+ 3 - 0
Sources/Help.php

@@ -84,6 +84,9 @@ function ShowAdminHelp()
 		loadLanguage('ManagePermissions');
 
 	loadTemplate('Help');
+	
+	// Allow mods to load their own language file here
+ 	call_integration_hook('integrate_helpadmin');
 
 	// Set the page title to something relevant.
 	$context['page_title'] = $context['forum_name'] . ' - ' . $txt['help'];

+ 13 - 0
Sources/Memberlist.php

@@ -175,6 +175,15 @@ function Memberlist()
 
 	$context['can_send_pm'] = allowedTo('pm_send');
 	$context['can_send_email'] = allowedTo('send_email_to_members');
+	
+	// Build the memberlist button array.
+	$context['memberlist_buttons'] = array(
+		'view_all_members' => array('text' => 'view_all_members', 'image' => 'mlist.png', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=all', 'active'=> true),
+		'mlist_search' => array('text' => 'mlist_search', 'image' => 'mlist.png', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=search'),
+	);
+	
+	// Allow mods to add additional buttons here
+	call_integration_hook('integrate_memberlist_buttons', array(&$context['memberlist_buttons']));	
 
 	// Jump to the sub action.
 	if (isset($subActions[$context['listing_by']]))
@@ -565,6 +574,10 @@ function MLSearch()
 		'url' => $scripturl . '?action=mlist;sa=search',
 		'name' => &$context['page_title']
 	);
+	
+	// Highlight the correct button, too!
+	unset($context['memberlist_buttons']['view_all_members']['active']);
+	$context['memberlist_buttons']['mlist_search']['active'] = true;
 }
 
 /**

+ 11 - 0
Sources/MessageIndex.php

@@ -632,6 +632,17 @@ function MessageIndex()
 
 	// If there are children, but no topics and no ability to post topics...
 	$context['no_topic_listing'] = !empty($context['boards']) && empty($context['topics']) && !$context['can_post_new'];
+	
+	// Build the message index button array.
+	$context['normal_buttons'] = array(
+		'new_topic' => array('test' => 'can_post_new', 'text' => 'new_topic', 'image' => 'new_topic.png', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0', 'active' => true),
+		'post_poll' => array('test' => 'can_post_poll', 'text' => 'new_poll', 'image' => 'new_poll.png', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0;poll'),
+		'notify' => array('test' => 'can_mark_notify', 'text' => $context['is_marked_notify'] ? 'unnotify' : 'notify', 'image' => ($context['is_marked_notify'] ? 'un' : ''). 'notify.png', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_board'] : $txt['notification_enable_board']) . '\');"', 'url' => $scripturl . '?action=notifyboard;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';board=' . $context['current_board'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
+		'markread' => array('text' => 'mark_read_short', 'image' => 'markread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=board;board=' . $context['current_board'] . '.0;' . $context['session_var'] . '=' . $context['session_id']),
+	);
+	
+	// Allow adding new buttons easily.
+	call_integration_hook('integrate_messageindex_buttons', array(&$context['normal_buttons']));
 }
 
 /**

+ 4 - 0
Sources/News.php

@@ -179,6 +179,10 @@ function ShowXmlFeed()
 		'members' => array('getXmlMembers', 'member'),
 		'profile' => array('getXmlProfile', null),
 	);
+	
+	// Easy adding of sub actions
+ 	call_integration_hook('integrate_xmlfeeds', array(&$subActions));
+	
 	if (empty($_GET['sa']) || !isset($subActions[$_GET['sa']]))
 		$_GET['sa'] = 'recent';
 

+ 12 - 0
Sources/PersonalMessage.php

@@ -842,6 +842,18 @@ function MessageFolder()
 		elseif (!empty($context['current_pm']))
 			markMessages($display_pms, $context['current_label_id']);
 	}
+	
+	// Build the conversation button array.
+	if ($context['display_mode'] == 2)
+	{
+		$context['conversation_buttons'] = array(
+			'reply' => array('text' => 'reply_to_all', 'image' => 'reply.png', 'lang' => true, 'url' => $scripturl . '?action=pm;sa=send;f=' . $context['folder'] . ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '') . ';pmsg=' . $context['current_pm'] . ';u=all', 'active' => true),
+			'delete' => array('text' => 'delete_conversation', 'image' => 'delete.png', 'lang' => true, 'url' => $scripturl . '?action=pm;sa=pmactions;pm_actions[' . $context['current_pm'] . ']=delete;conversation;f=' . $context['folder'] . ';start=' . $context['start'] . ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '') . ';' . $context['session_var'] . '=' . $context['session_id'], 'custom' => 'onclick="return confirm(\'' . addslashes($txt['remove_message']) . '?\');"'),
+		);
+		
+		// Allow mods to add additional buttons here
+		call_integration_hook('integrate_conversation_buttons', array(&$context['conversation_buttons']));
+	}
 }
 
 /**

+ 8 - 0
Sources/Poll.php

@@ -213,6 +213,9 @@ function Vote()
 		$cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
 		smf_setcookie('guest_poll_vote', $_COOKIE['guest_poll_vote'], time() + 2500000, $cookie_url[1], $cookie_url[0], false, false);
 	}
+	
+	// Maybe let a social networking mod log this, or something?
+	call_integration_hook('integrate_poll_vote', array(&$row['id_poll'], &$pollOptions));
 
 	// Return to the post...
 	redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
@@ -879,6 +882,8 @@ function EditPoll2()
 			)
 		);
 	}
+	
+	call_integration_hook('integrate_poll_add_edit', array($bcinfo['id_poll'], $isEdit));
 
 	// Off we go.
 	redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
@@ -971,6 +976,9 @@ function RemovePoll()
 			'no_poll' => 0,
 		)
 	);
+	
+	// A mod might have logged this (social network?), so let them remove, it too
+	call_integration_hook('integrate_poll_remove', array(&$pollID));
 
 	// Take the moderator back to the topic.
 	redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);

+ 2 - 0
Sources/Post.php

@@ -2001,6 +2001,8 @@ function Post2()
 			$pollOptions,
 			array('id_poll', 'id_choice')
 		);
+		
+		call_integration_hook('integrate_poll_add_edit', array($id_poll, false));
 	}
 	else
 		$id_poll = 0;

+ 8 - 0
Sources/Profile-Modify.php

@@ -670,6 +670,8 @@ function loadProfileFields($force_reload = false)
 			'permission' => 'profile_extra',
 		),
 	);
+	
+	call_integration_hook('integrate_profile_fields', array(&$profile_fields));
 
 	$disabled_fields = !empty($modSettings['disabled_profile_fields']) ? explode(',', $modSettings['disabled_profile_fields']) : array();
 	// For each of the above let's take out the bits which don't apply - to save memory and security!
@@ -1339,6 +1341,8 @@ function editBuddies($memID)
 	if (isset($_GET['remove']))
 	{
 		checkSession('get');
+		
+		call_integration_hook('integrate_remove_buddy', array($memID));
 
 		// Heh, I'm lazy, do it the easy way...
 		foreach ($buddiesArray as $key => $buddy)
@@ -1368,6 +1372,8 @@ function editBuddies($memID)
 			if (strlen($new_buddies[$k]) == 0 || in_array($new_buddies[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name'])))
 				unset($new_buddies[$k]);
 		}
+		
+		call_integration_hook('integrate_add_buddies', array($memID, &$new_buddies));
 
 		if (!empty($new_buddies))
 		{
@@ -1430,6 +1436,8 @@ function editBuddies($memID)
 		loadMemberContext($buddy);
 		$context['buddies'][$buddy] = $memberContext[$buddy];
 	}
+	
+	call_integration_hook('integrate_view_buddies', array($memID));
 }
 
 /**

+ 3 - 0
Sources/Profile-View.php

@@ -801,6 +801,9 @@ function statPanel($memID)
 
 	// Put it in the right order.
 	ksort($context['posts_by_time']);
+	
+	// Custom stats (just add a template_layer to add it to the template!)
+ 	call_integration_hook('integrate_profile_stats', array($memID));
 }
 
 /**

+ 44 - 0
Sources/Recent.php

@@ -432,6 +432,8 @@ function UnreadTopics()
 		header('HTTP/1.1 403 Forbidden');
 		die;
 	}
+	
+	$context['showCheckboxes'] = !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $settings['show_mark_read'];
 
 	$context['showing_all_topics'] = isset($_GET['all']);
 	$context['start'] = (int) $_REQUEST['start'];
@@ -1316,6 +1318,48 @@ function UnreadTopics()
 
 	$context['querystring_board_limits'] = sprintf($context['querystring_board_limits'], $_REQUEST['start']);
 	$context['topics_to_mark'] = implode('-', $topic_ids);
+	
+	if ($settings['show_mark_read'])
+	{
+		// Build the recent button array.
+		if ($is_topics)
+		{
+			$context['recent_buttons'] = array(
+				'markread' => array('text' => !empty($context['no_board_limits']) ? 'mark_as_read' : 'mark_read_short', 'image' => 'markread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=' . (!empty($context['no_board_limits']) ? 'all' : 'board' . $context['querystring_board_limits']) . ';' . $context['session_var'] . '=' . $context['session_id']),
+			);
+
+			if ($context['showCheckboxes'])
+				$context['recent_buttons']['markselectread'] = array(
+					'text' => 'quick_mod_markread',
+					'image' => 'markselectedread.png',
+					'lang' => true,
+					'url' => 'javascript:document.quickModForm.submit();',
+				);
+				
+			if (!empty($context['topics']) && !$context['showing_all_topics'])
+				$context['recent_buttons']['readall'] = array('text' => 'unread_topics_all', 'image' => 'markreadall.png', 'lang' => true, 'url' => $scripturl . '?action=unread;all' . $context['querystring_board_limits'], 'active' => true);	
+		}
+		elseif (!$is_topics && isset($context['topics_to_mark']))
+		{
+			$context['recent_buttons'] = array(
+				'markread' => array('text' => 'mark_as_read', 'image' => 'markread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=unreadreplies;topics=' . $context['topics_to_mark'] . ';' . $context['session_var'] . '=' . $context['session_id']),
+			);
+
+			if ($context['showCheckboxes'])
+				$context['recent_buttons']['markselectread'] = array(
+					'text' => 'quick_mod_markread',
+					'image' => 'markselectedread.png',
+					'lang' => true,
+					'url' => 'javascript:document.quickModForm.submit();',
+				);
+		}
+
+		// Allow mods to add additional buttons here
+		call_integration_hook('integrate_recent_buttons', array(&$context['recent_buttons']));
+	}
+	
+	// Allow helpdesks and bug trackers and what not to add their own unread data (just add a template_layer to show custom stuff in the template!)
+ 	call_integration_hook('integrate_unread_list');
 }
 
 ?>

+ 6 - 0
Sources/RemoveTopic.php

@@ -533,6 +533,9 @@ function removeTopics($topics, $decreasePostCount = true, $ignoreRecycling = fal
 			'topics' => $topics,
 		)
 	);
+	
+	// Maybe there's a mod that wants to delete topic related data of its own
+ 	call_integration_hook('integrate_remove_topics', array($topics));
 
 	// Update the totals...
 	updateStats('message');
@@ -959,6 +962,9 @@ function removeMessage($message, $decreasePostCount = true)
 			'id_msg' => $message,
 		);
 		removeAttachments($attachmentQuery);
+		
+		// Allow mods to remove message related data of their own (likes, maybe?)
+		call_integration_hook('integrate_remove_message', array($message));
 	}
 
 	// Update the pesky statistics.

+ 10 - 0
Sources/Reports.php

@@ -103,6 +103,16 @@ function ReportsMain()
 
 	// Make the page title more descriptive.
 	$context['page_title'] .= ' - ' . (isset($txt['gr_type_' . $context['report_type']]) ? $txt['gr_type_' . $context['report_type']] : $context['report_type']);
+	
+	// Build the reports button array.
+	$context['report_buttons'] = array(
+		'generate_reports' => array('text' => 'generate_reports', 'image' => 'print.png', 'lang' => true, 'url' => $scripturl . '?action=admin;area=reports', 'active' => true),
+		'print' => array('text' => 'print', 'image' => 'print.png', 'lang' => true, 'url' => $scripturl . '?action=admin;area=reports;rt=' . $context['report_type']. ';st=print', 'custom' => 'target="_blank"'),
+	);
+	
+	// Allow mods to add additional buttons here
+	call_integration_hook('integrate_report_buttons', array(&$context['report_buttons']));	
+	
 	// Now generate the data.
 	$context['report_types'][$context['report_type']]['function']();
 

+ 3 - 0
Sources/Stats.php

@@ -627,6 +627,9 @@ function DisplayStats()
 		return;
 
 	getDailyStats(implode(' OR ', $condition_text), $condition_params);
+	
+	// Custom stats (just add a template_layer to add it to the template!)
+ 	call_integration_hook('integrate_forum_stats');
 }
 
 /**

+ 7 - 0
Sources/Subs-Calendar.php

@@ -885,6 +885,8 @@ function insertEvent(&$eventOptions)
 
 	// Store the just inserted id_event for future reference.
 	$eventOptions['id'] = $smcFunc['db_insert_id']('{db_prefix}calendar', 'id_event');
+	
+	call_integration_hook('integrate_insert_event', array($eventOptions));
 
 	// Update the settings to show something calendarish was updated.
 	updateSettings(array(
@@ -914,6 +916,9 @@ function modifyEvent($event_id, &$eventOptions)
 	if (!isset($eventOptions['end_date']))
 		$eventOptions['end_date'] = strftime('%Y-%m-%d', mktime(0, 0, 0, $month, $day, $year) + $eventOptions['span'] * 86400);
 
+	
+	call_integration_hook('integrate_modify_event', array($event_id, &$eventOptions));		
+		
 	$smcFunc['db_query']('', '
 		UPDATE {db_prefix}calendar
 		SET
@@ -953,6 +958,8 @@ function removeEvent($event_id)
 			'id_event' => $event_id,
 		)
 	);
+	
+	call_integration_hook('integrate_remove_event', array($event_id));
 
 	updateSettings(array(
 		'calendar_updated' => time(),

+ 3 - 0
Sources/Subs-Members.php

@@ -1177,6 +1177,9 @@ function reattributePosts($memID, $email = false, $membername = false, $post_cou
 			'memID' => $memID,
 		)
 	);
+	
+	// Allow mods with their own post tables to reattribute posts as well :)
+ 	call_integration_hook('integrate_reattribute_posts', array(&$memID, &$email, &$membername, &$post_count));
 }
 
 /**

+ 4 - 0
Sources/Xml.php

@@ -35,6 +35,10 @@ function XMLhttpMain()
 			'function' => 'RetrievePreview',
 		),
 	);
+	
+	// Easy adding of sub actions
+ 	call_integration_hook('integrate_xmlhttp', array(&$sub_actions));
+	
 	if (!isset($_REQUEST['sa'], $sub_actions[$_REQUEST['sa']]))
 		fatal_lang_error('no_access', false);
 

+ 1 - 6
Themes/default/BoardIndex.template.php

@@ -234,11 +234,6 @@ function template_main()
 		echo '
 	<div id="posting_icons" class="floatleft">';
 
-		// Mark read button.
-		$mark_read_button = array(
-			'markread' => array('text' => 'mark_as_read', 'image' => 'markread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;' . $context['session_var'] . '=' . $context['session_id']),
-		);
-
 		echo '
 		<ul class="reset">
 			<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_some.png" alt="" /> ', $txt['new_posts'], '</li>
@@ -249,7 +244,7 @@ function template_main()
 
 		// Show the mark all as read button?
 		if ($settings['show_mark_read'] && !empty($context['categories']))
-			echo '<div class="mark_read">', template_button_strip($mark_read_button, 'right'), '</div>';
+			echo '<div class="mark_read">', template_button_strip($context['mark_read_button'], 'right'), '</div>';
 	}
 	else
 	{

+ 1 - 6
Themes/default/Calendar.template.php

@@ -25,12 +25,7 @@ function template_main()
 			<div id="main_grid" style="', isBrowser('is_ie') && !isBrowser('is_ie8') ? 'float: ' . ($context['right_to_left'] ? 'right; padding-right' : 'left; padding-left') . ': 20px;' : 'margin-' . ($context['right_to_left'] ? 'right' : 'left') . ': 220px; ', '">
 				', $context['view_week'] ? template_show_week_grid('main') : template_show_month_grid('main');
 
-	// Build the calendar button array.
-	$calendar_buttons = array(
-		'post_event' => array('test' => 'can_post', 'text' => 'calendar_post_event', 'image' => 'calendarpe.png', 'lang' => true, 'url' => $scripturl . '?action=calendar;sa=post;month=' . $context['current_month'] . ';year=' . $context['current_year'] . ';' . $context['session_var'] . '=' . $context['session_id']),
-	);
-
-	template_button_strip($calendar_buttons, 'right');
+	template_button_strip($context['calendar_buttons'], 'right');
 
 	// Show some controls to allow easy calendar navigation.
 	echo '

+ 4 - 43
Themes/default/Display.template.php

@@ -114,17 +114,7 @@ function template_main()
 			</div>
 			<div id="pollmoderation">';
 
-		// Build the poll moderation button array.
-		$poll_buttons = array(
-			'vote' => array('test' => 'allow_return_vote', 'text' => 'poll_return_vote', 'image' => 'poll_options.png', 'lang' => true, 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start']),
-			'results' => array('test' => 'show_view_results_button', 'text' => 'poll_results', 'image' => 'poll_results.png', 'lang' => true, 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start'] . ';viewresults'),
-			'change_vote' => array('test' => 'allow_change_vote', 'text' => 'poll_change_vote', 'image' => 'poll_change_vote.png', 'lang' => true, 'url' => $scripturl . '?action=vote;topic=' . $context['current_topic'] . '.' . $context['start'] . ';poll=' . $context['poll']['id'] . ';' . $context['session_var'] . '=' . $context['session_id']),
-			'lock' => array('test' => 'allow_lock_poll', 'text' => (!$context['poll']['is_locked'] ? 'poll_lock' : 'poll_unlock'), 'image' => 'poll_lock.png', 'lang' => true, 'url' => $scripturl . '?action=lockvoting;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
-			'edit' => array('test' => 'allow_edit_poll', 'text' => 'poll_edit', 'image' => 'poll_edit.png', 'lang' => true, 'url' => $scripturl . '?action=editpoll;topic=' . $context['current_topic'] . '.' . $context['start']),
-			'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.png', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
-		);
-
-		template_button_strip($poll_buttons);
+		template_button_strip($context['poll_buttons']);
 
 		echo '
 			</div>';
@@ -157,23 +147,10 @@ function template_main()
 			</div>';
 	}
 
-	// Build the normal button array.
-	$normal_buttons = array(
-		'reply' => array('test' => 'can_reply', 'text' => 'reply', 'image' => 'reply.png', 'lang' => true, 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message'], 'active' => true),
-		'add_poll' => array('test' => 'can_add_poll', 'text' => 'add_poll', 'image' => 'add_poll.png', 'lang' => true, 'url' => $scripturl . '?action=editpoll;add;topic=' . $context['current_topic'] . '.' . $context['start']),
-		'notify' => array('test' => 'can_mark_notify', 'text' => $context['is_marked_notify'] ? 'unnotify' : 'notify', 'image' => ($context['is_marked_notify'] ? 'un' : '') . 'notify.png', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_topic'] : $txt['notification_enable_topic']) . '\');"', 'url' => $scripturl . '?action=notify;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
-		'mark_unread' => array('test' => 'can_mark_unread', 'text' => 'mark_unread', 'image' => 'markunread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
-		'send' => array('test' => 'can_send_topic', 'text' => 'send_topic', 'image' => 'sendtopic.png', 'lang' => true, 'url' => $scripturl . '?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.0'),
-		'print' => array('test' => 'can_print', 'text' => 'print', 'image' => 'print.png', 'lang' => true, 'custom' => 'rel="new_win nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'),
-	);
-
-	// Allow adding new buttons easily.
-	call_integration_hook('integrate_display_buttons', array(&$normal_buttons));
-
 	// Show the page index... "Pages: [1]".
 	echo '
 			<div class="pagesection">
-				<div class="nextlinks">', $context['previous_next'], '</div>', template_button_strip($normal_buttons, 'right'), '
+				<div class="nextlinks">', $context['previous_next'], '</div>', template_button_strip($context['normal_buttons'], 'right'), '
 				<div class="pagelinks floatleft">', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . ' &nbsp;&nbsp;<a href="#lastPost"><strong>' . $txt['go_down'] . '</strong></a>' : '', '</div>
 			</div>';
 
@@ -664,7 +641,7 @@ function template_main()
 	// Show the page index... "Pages: [1]".
 	echo '
 			<div class="pagesection">
-				', template_button_strip($normal_buttons, 'right'), '
+				', template_button_strip($context['normal_buttons'], 'right'), '
 				<div class="pagelinks floatleft">', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . ' &nbsp;&nbsp;<a href="#top"><strong>' . $txt['go_up'] . '</strong></a>' : '', '</div>
 				<div class="nextlinks_bottom">', $context['previous_next'], '</div>
 			</div>';
@@ -672,24 +649,8 @@ function template_main()
 	// Show the lower breadcrumbs.
 	theme_linktree();
 
-	$mod_buttons = array(
-		'move' => array('test' => 'can_move', 'text' => 'move_topic', 'image' => 'admin_move.png', 'lang' => true, 'url' => $scripturl . '?action=movetopic;current_board=' . $context['current_board'] . ';topic=' . $context['current_topic'] . '.0'),
-		'delete' => array('test' => 'can_delete', 'text' => 'remove_topic', 'image' => 'admin_rem.png', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['are_sure_remove_topic'] . '\');"', 'url' => $scripturl . '?action=removetopic2;topic=' . $context['current_topic'] . '.0;' . $context['session_var'] . '=' . $context['session_id']),
-		'lock' => array('test' => 'can_lock', 'text' => empty($context['is_locked']) ? 'set_lock' : 'set_unlock', 'image' => 'admin_lock.png', 'lang' => true, 'url' => $scripturl . '?action=lock;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
-		'sticky' => array('test' => 'can_sticky', 'text' => empty($context['is_sticky']) ? 'set_sticky' : 'set_nonsticky', 'image' => 'admin_sticky.png', 'lang' => true, 'url' => $scripturl . '?action=sticky;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
-		'merge' => array('test' => 'can_merge', 'text' => 'merge', 'image' => 'merge.png', 'lang' => true, 'url' => $scripturl . '?action=mergetopics;board=' . $context['current_board'] . '.0;from=' . $context['current_topic']),
-		'calendar' => array('test' => 'calendar_post', 'text' => 'calendar_link', 'image' => 'linktocal.png', 'lang' => true, 'url' => $scripturl . '?action=post;calendar;msg=' . $context['topic_first_message'] . ';topic=' . $context['current_topic'] . '.0'),
-	);
-
-	// Restore topic. eh?  No monkey business.
-	if ($context['can_restore_topic'])
-		$mod_buttons[] = array('text' => 'restore_topic', 'image' => '', 'lang' => true, 'url' => $scripturl . '?action=restoretopic;topics=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']);
-
-	// Allow adding new mod buttons easily.
-	call_integration_hook('integrate_mod_buttons', array(&$mod_buttons));
-
 	echo '
-			<div id="moderationbuttons">', template_button_strip($mod_buttons, 'bottom', array('id' => 'moderationbuttons_strip')), '</div>';
+			<div id="moderationbuttons">', template_button_strip($context['mod_buttons'], 'bottom', array('id' => 'moderationbuttons_strip')), '</div>';
 
 	// Show the jumpto box, or actually...let Javascript do it.
 	echo '

+ 2 - 14
Themes/default/Memberlist.template.php

@@ -15,12 +15,6 @@ function template_main()
 {
 	global $context, $settings, $options, $scripturl, $txt;
 
-	// Build the memberlist button array.
-	$memberlist_buttons = array(
-			'view_all_members' => array('text' => 'view_all_members', 'image' => 'mlist.png', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=all', 'active'=> true),
-			'mlist_search' => array('text' => 'mlist_search', 'image' => 'mlist.png', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=search'),
-		);
-
 	echo '
 	<div class="main_section" id="memberlist">
 		<div class="cat_bar">
@@ -33,7 +27,7 @@ function template_main()
 			</h4>
 		</div>
 		<div class="pagesection">
-			', template_button_strip($memberlist_buttons, 'right'), '
+			', template_button_strip($context['memberlist_buttons'], 'right'), '
 			<div class="pagelinks floatleft">', $txt['pages'], ': ', $context['page_index'], '</div>
 		</div>';
 
@@ -165,12 +159,6 @@ function template_search()
 {
 	global $context, $settings, $options, $scripturl, $txt;
 
-	// Build the memberlist button array.
-	$memberlist_buttons = array(
-			'view_all_members' => array('text' => 'view_all_members', 'image' => 'mlist.png', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=all'),
-			'mlist_search' => array('text' => 'mlist_search', 'image' => 'mlist.png', 'lang' => true, 'url' => $scripturl . '?action=mlist' . ';sa=search', 'active' => true),
-		);
-
 	// Start the submission form for the search!
 	echo '
 	<form action="', $scripturl, '?action=mlist;sa=search" method="post" accept-charset="', $context['character_set'], '">
@@ -181,7 +169,7 @@ function template_search()
 				</h3>
 			</div>
 			<div class="pagesection">
-				', template_button_strip($memberlist_buttons, 'right'), '
+				', template_button_strip($context['memberlist_buttons'], 'right'), '
 			</div>';
 	
 	// Display the input boxes for the form.

+ 3 - 14
Themes/default/MessageIndex.template.php

@@ -121,27 +121,16 @@ function template_main()
 		echo '
 	<p class="description_board">', $context['description'], '</p>';
 
-	// Create the button set...
-	$normal_buttons = array(
-		'new_topic' => array('test' => 'can_post_new', 'text' => 'new_topic', 'image' => 'new_topic.png', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0', 'active' => true),
-		'post_poll' => array('test' => 'can_post_poll', 'text' => 'new_poll', 'image' => 'new_poll.png', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0;poll'),
-		'notify' => array('test' => 'can_mark_notify', 'text' => $context['is_marked_notify'] ? 'unnotify' : 'notify', 'image' => ($context['is_marked_notify'] ? 'un' : ''). 'notify.png', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_board'] : $txt['notification_enable_board']) . '\');"', 'url' => $scripturl . '?action=notifyboard;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';board=' . $context['current_board'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
-		'markread' => array('text' => 'mark_read_short', 'image' => 'markread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=board;board=' . $context['current_board'] . '.0;' . $context['session_var'] . '=' . $context['session_id']),
-	);
-
 	// They can only mark read if they are logged in and it's enabled!
 	if (!$context['user']['is_logged'] || !$settings['show_mark_read'])
-		unset($normal_buttons['markread']);
-
-	// Allow adding new buttons easily.
-	call_integration_hook('integrate_messageindex_buttons', array(&$normal_buttons));
+		unset($context['normal_buttons']['markread']);
 
 	if (!$context['no_topic_listing'])
 	{
 		echo '
 	<div class="pagesection">
 		<div class="pagelinks floatleft">', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . '&nbsp;&nbsp;<a href="#bot"><strong>' . $txt['go_down'] . '</strong></a>' : '', '</div>
-		', template_button_strip($normal_buttons, 'right'), '
+		', template_button_strip($context['normal_buttons'], 'right'), '
 	</div>';
 
 		// If Quick Moderation is enabled start the form.
@@ -362,7 +351,7 @@ function template_main()
 
 		echo '
 	<div class="pagesection">
-		', template_button_strip($normal_buttons, 'right'), '
+		', template_button_strip($context['normal_buttons'], 'right'), '
 		<div class="pagelinks">', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . '&nbsp;&nbsp;<a href="#top"><strong>' . $txt['go_up'] . '</strong></a>' : '', '</div>
 	</div>';
 	}

+ 3 - 9
Themes/default/PersonalMessage.template.php

@@ -158,17 +158,11 @@ function template_folder()
 		// Show a few buttons if we are in conversation mode and outputting the first message.
 		if ($context['display_mode'] == 2)
 		{
-			// Build the normal button array.
-			$conversation_buttons = array(
-				'reply' => array('text' => 'reply_to_all', 'image' => 'reply.png', 'lang' => true, 'url' => $scripturl . '?action=pm;sa=send;f=' . $context['folder'] . ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '') . ';pmsg=' . $context['current_pm'] . ';u=all', 'active' => true),
-				'delete' => array('text' => 'delete_conversation', 'image' => 'delete.png', 'lang' => true, 'url' => $scripturl . '?action=pm;sa=pmactions;pm_actions[' . $context['current_pm'] . ']=delete;conversation;f=' . $context['folder'] . ';start=' . $context['start'] . ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '') . ';' . $context['session_var'] . '=' . $context['session_id'], 'custom' => 'onclick="return confirm(\'' . addslashes($txt['remove_message']) . '?\');"'),
-			);
-
 			// Show the conversation buttons.
 			echo '
 					<div class="pagesection">';
 
-			template_button_strip($conversation_buttons, 'right');
+			template_button_strip($context['conversation_buttons'], 'right');
 
 			echo '
 					</div>';
@@ -504,13 +498,13 @@ function template_folder()
 	</div>';
 
 		// Show a few buttons if we are in conversation mode and outputting the first message.
-		elseif ($context['display_mode'] == 2 && isset($conversation_buttons))
+		elseif ($context['display_mode'] == 2 && isset($context['conversation_buttons']))
 		{
 			echo '
 
 	<div class="pagesection">';
 
-			template_button_strip($conversation_buttons, 'right');
+			template_button_strip($context['conversation_buttons'], 'right');
 
 			echo '
 	</div>';

+ 22 - 61
Themes/default/Recent.template.php

@@ -89,38 +89,20 @@ function template_unread()
 	echo '
 	<div id="recent" class="main_content">';
 
-	$showCheckboxes = !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $settings['show_mark_read'];
-
-	if ($showCheckboxes)
+	if ($context['showCheckboxes'])
 		echo '
 		<form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm" style="margin: 0;">
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
 			<input type="hidden" name="qaction" value="markread" />
 			<input type="hidden" name="redirect_url" value="action=unread', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '" />';
 
-	if ($settings['show_mark_read'])
-	{
-		// Generate the button strip.
-		$mark_read = array(
-			'markread' => array('text' => !empty($context['no_board_limits']) ? 'mark_as_read' : 'mark_read_short', 'image' => 'markread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=' . (!empty($context['no_board_limits']) ? 'all' : 'board' . $context['querystring_board_limits']) . ';' . $context['session_var'] . '=' . $context['session_id']),
-		);
-
-		if ($showCheckboxes)
-			$mark_read['markselectread'] = array(
-				'text' => 'quick_mod_markread',
-				'image' => 'markselectedread.png',
-				'lang' => true,
-				'url' => 'javascript:document.quickModForm.submit();',
-			);
-	}
-
 	if (!empty($context['topics']))
 	{
 		echo '
 			<div class="pagesection">';
 
-		if (!empty($mark_read) && !empty($settings['use_tabs']))
-			template_button_strip($mark_read, 'right');
+		if (!empty($context['recent_buttons']) && !empty($settings['use_tabs']))
+			template_button_strip($context['recent_buttons'], 'right');
 
 		echo '
 				<span>', $txt['pages'], ': ', $context['page_index'], '</span>
@@ -140,7 +122,7 @@ function template_unread()
 							</th>';
 
 		// Show a "select all" box for quick moderation?
-		if ($showCheckboxes)
+		if ($context['showCheckboxes'])
 			echo '
 							<th scope="col" width="22%">
 								<a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=last_post', $context['sort_by'] == 'last_post' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] == 'last_post' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a>
@@ -198,7 +180,7 @@ function template_unread()
 								', $txt['by'], ' ', $topic['last_post']['member']['link'], '
 							</td>';
 
-			if ($showCheckboxes)
+			if ($context['showCheckboxes'])
 				echo '
 							<td class="' . (!empty($color_class) ? $color_class : 'windowbg2') . '" valign="middle" align="center">
 								<input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check" />
@@ -207,14 +189,11 @@ function template_unread()
 						</tr>';
 		}
 
-		if (!empty($context['topics']) && !$context['showing_all_topics'])
-			$mark_read['readall'] = array('text' => 'unread_topics_all', 'image' => 'markreadall.png', 'lang' => true, 'url' => $scripturl . '?action=unread;all' . $context['querystring_board_limits'], 'active' => true);
-
-		if (empty($settings['use_tabs']) && !empty($mark_read))
+		if (empty($settings['use_tabs']) && !empty($context['recent_buttons']))
 			echo '
 						<tr class="catbg">
-							<td colspan="', $showCheckboxes ? '6' : '5', '" align="right">
-								', template_button_strip($mark_read, 'top'), '
+							<td colspan="', $context['showCheckboxes'] ? '6' : '5', '" align="right">
+								', template_button_strip($context['recent_buttons'], 'top'), '
 							</td>
 						</tr>';
 
@@ -228,8 +207,8 @@ function template_unread()
 			</div>
 			<div class="pagesection" id="readbuttons">';
 
-		if (!empty($settings['use_tabs']) && !empty($mark_read))
-			template_button_strip($mark_read, 'right');
+		if (!empty($settings['use_tabs']) && !empty($context['recent_buttons']))
+			template_button_strip($context['recent_buttons'], 'right');
 
 		echo '
 				<span>', $txt['pages'], ': ', $context['page_index'], '</span>
@@ -243,7 +222,7 @@ function template_unread()
 				</h3>
 			</div>';
 
-	if ($showCheckboxes)
+	if ($context['showCheckboxes'])
 		echo '
 		</form>';
 
@@ -272,38 +251,20 @@ function template_replies()
 	echo '
 	<div id="recent">';
 
-	$showCheckboxes = !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && $settings['show_mark_read'];
-
-	if ($showCheckboxes)
+	if ($context['showCheckboxes'])
 		echo '
 		<form action="', $scripturl, '?action=quickmod" method="post" accept-charset="', $context['character_set'], '" name="quickModForm" id="quickModForm" style="margin: 0;">
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
 			<input type="hidden" name="qaction" value="markread" />
 			<input type="hidden" name="redirect_url" value="action=unreadreplies', (!empty($context['showing_all_topics']) ? ';all' : ''), $context['querystring_board_limits'], '" />';
 
-	if (isset($context['topics_to_mark']) && !empty($settings['show_mark_read']))
-	{
-		// Generate the button strip.
-		$mark_read = array(
-			'markread' => array('text' => 'mark_as_read', 'image' => 'markread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=unreadreplies;topics=' . $context['topics_to_mark'] . ';' . $context['session_var'] . '=' . $context['session_id']),
-		);
-
-		if ($showCheckboxes)
-			$mark_read['markselectread'] = array(
-				'text' => 'quick_mod_markread',
-				'image' => 'markselectedread.png',
-				'lang' => true,
-				'url' => 'javascript:document.quickModForm.submit();',
-			);
-	}
-
 	if (!empty($context['topics']))
 	{
 		echo '
 			<div class="pagesection">';
 
-		if (!empty($mark_read) && !empty($settings['use_tabs']))
-			template_button_strip($mark_read, 'right');
+		if (!empty($context['recent_buttons']) && !empty($settings['use_tabs']))
+			template_button_strip($context['recent_buttons'], 'right');
 
 		echo '
 				<span>', $txt['pages'], ': ', $context['page_index'], '</span>
@@ -323,7 +284,7 @@ function template_replies()
 							</th>';
 
 		// Show a "select all" box for quick moderation?
-		if ($showCheckboxes)
+		if ($context['showCheckboxes'])
 				echo '
 							<th scope="col" width="22%">
 								<a href="', $scripturl, '?action=unreadreplies', $context['querystring_board_limits'], ';sort=last_post', $context['sort_by'] === 'last_post' && $context['sort_direction'] === 'up' ? ';desc' : '', '">', $txt['last_post'], $context['sort_by'] === 'last_post' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a>
@@ -381,7 +342,7 @@ function template_replies()
 								', $txt['by'], ' ', $topic['last_post']['member']['link'], '
 							</td>';
 
-			if ($showCheckboxes)
+			if ($context['showCheckboxes'])
 				echo '
 							<td class="' . (!empty($color_class) ? $color_class : 'windowbg2') . '" valign="middle" align="center">
 								<input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check" />
@@ -390,11 +351,11 @@ function template_replies()
 						</tr>';
 		}
 
-		if (empty($settings['use_tabs']) && !empty($mark_read))
+		if (empty($settings['use_tabs']) && !empty($context['recent_buttons']))
 			echo '
 						<tr class="catbg">
-							<td colspan="', $showCheckboxes ? '6' : '5', '" align="right">
-								', template_button_strip($mark_read, 'top'), '
+							<td colspan="', $context['showCheckboxes'] ? '6' : '5', '" align="right">
+								', template_button_strip($context['recent_buttons'], 'top'), '
 							</td>
 						</tr>';
 
@@ -404,8 +365,8 @@ function template_replies()
 			</div>
 			<div class="pagesection">';
 
-		if (!empty($settings['use_tabs']) && !empty($mark_read))
-			template_button_strip($mark_read, 'right');
+		if (!empty($settings['use_tabs']) && !empty($context['recent_buttons']))
+			template_button_strip($context['recent_buttons'], 'right');
 
 		echo '
 				<span>', $txt['pages'], ': ', $context['page_index'], '</span>
@@ -419,7 +380,7 @@ function template_replies()
 				</h3>
 			</div>';
 
-	if ($showCheckboxes)
+	if ($context['showCheckboxes'])
 		echo '
 		</form>';
 

+ 2 - 8
Themes/default/Reports.template.php

@@ -63,12 +63,6 @@ function template_main()
 {
 	global $context, $settings, $options, $scripturl, $txt, $modSettings;
 
-	// Build the reports button array.
-	$report_buttons = array(
-			'generate_reports' => array('text' => 'generate_reports', 'image' => 'print.png', 'lang' => true, 'url' => $scripturl . '?action=admin;area=reports', 'active' => true),
-			'print' => array('text' => 'print', 'image' => 'print.png', 'lang' => true, 'url' => $scripturl . '?action=admin;area=reports;rt=' . $context['report_type']. ';st=print', 'custom' => 'target="_blank"'),
-		);
-
 	echo '
 	<div id="admincenter">
 		<div class="title_bar">
@@ -76,8 +70,8 @@ function template_main()
 		</div>
 		<div id="report_buttons">';
 
-	if (!empty($report_buttons) && !empty($settings['use_tabs']))
-		template_button_strip($report_buttons, 'right');
+	if (!empty($context['report_buttons']) && !empty($settings['use_tabs']))
+		template_button_strip($context['report_buttons'], 'right');
 
 	echo '
 		</div>';