Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: jdarwood007/smf-unreadPM_count
base: d9cc04b6eb
...
head fork: jdarwood007/smf-unreadPM_count
compare: 8bc886c69c
  • 1 commit
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on Apr 14, 2012
Jeremy D ! Fixed undefined action in whois online by changing it to use xmlht…
…tp and overriding the default xmlhttp function
8bc886c
Showing with 19 additions and 2 deletions.
  1. +19 −2 UnreadPMs.php
View
21 UnreadPMs.php
@@ -5,7 +5,11 @@ function uPMs_hook_actionArray($actionArray)
{
global $modSettings;
- $actionArray['unreadpms'] = array('UnreadPMs.php', 'UnreadPMsXML');
+ // We will save the original action for use later.
+ $modSettings['action_override_xmlhttp_uPMs'] = $actionArray['xmlhttp'];
+
+ // We will overload the xmlhttp action for our needs.
+ $actionArray['xmlhttp'] = array('UnreadPMs.php', 'UPMs_override_action_xmlhttp');
}
// Adds a hook to the end of loadTheme();
@@ -27,7 +31,7 @@ function uPMs_hook_load_theme()
{
window.setTimeout(\'funreadPMs();\', ' . $modSettings['unreadPMstimeout'] * 600 . ');
- var oNewPms = getXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=unreadpms\');
+ var oNewPms = getXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=xmlhttp;sa=unreadpms\');
if (oNewPms.responseXML)
{
@@ -48,6 +52,19 @@ function uPMs_hook_general_mod_settings($config_vars)
$config_vars[] = array('int', 'unreadPMstimeout', 'postinput' => $txt['unreadPMstimeout_post']);
}
+// Overrides the xmlhttp function.
+function UPMs_override_action_xmlhttp()
+{
+ global $modSettings, $sourcedir;
+
+ if (isset($_GET['sa']) && $_GET['sa'] == 'unreadpms')
+ UnreadPMsXML();
+
+ // Otherwise we will act just like index.php would have.
+ require_once($sourcedir . '/' . $modSettings['action_override_xmlhttp_uPMs'][0]);
+ return $modSettings['action_override_xmlhttp_uPMs'][1]();
+}
+
// Provides the XML for our javascript to read.
function UnreadPMsXML()
{

No commit comments for this range

Something went wrong with that request. Please try again.