Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Archives
  3. » [archived] wan_error_email

#1 2006-02-24 00:15:49

wanni
Archived Plugin Author
Registered: 2005-11-11
Posts: 32

[archived] wan_error_email

Notice: This thread is archived, this plugin is available here

**********************************************************

This small plugin sends an email to the site-admin (or another specified user) if an error occurs that is handled by textpattern.

More Information
Download
This plugin at textpattern.org

Please post in this thread if you have found any bugs or if you have any suggestions how to improve this plugin.

Offline

#2 2006-02-24 00:27:36

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: [archived] wan_error_email

Thanks, very useful.

Offline

#3 2007-09-16 07:30:05

azw
Member
Registered: 2007-01-29
Posts: 279

Re: [archived] wan_error_email

Thanks for this helpful plug-in.

There’s a small problem in the Plug-in tab’s “View” pane related to this plug-in.

The Usage explanation doesn’t show the tag to be used:

Usage
Place somewhere in your error-template.

Last edited by azw (2007-09-16 07:30:29)

Offline

#4 2008-03-14 08:45:02

azw
Member
Registered: 2007-01-29
Posts: 279

Re: [archived] wan_error_email

If a bad address is typed into the address bar, this message gets added to the top of the HTML output, which destroys the page layout. Do you know what’s causing this?

<pre>Error de etiqueta: <b>&lt;txp:wan_error_email/&gt;</b> -> <b> Notice: Undefined index:  HTTP_REFERER  on line 13</b></pre>
<pre style="padding-left: 2em;" class="backtrace"><code>textpattern/publish.php:970 wan_error_email()
processTags()
textpattern/publish.php:929 preg_replace_callback()
textpattern/lib/txplib_misc.php:1696 parse()
textpattern/publish.php:454 txp_die()
index.php:40 textpattern()</code></pre>

Offline

#5 2008-03-14 09:02:51

azw
Member
Registered: 2007-01-29
Posts: 279

Re: [archived] wan_error_email

Okay, here’s an easy fix for it. I added a conditional so that if the HTTP_REFERER variable is not set, it won’t be a problem. This is a pretty common issue, I think.

To use this, you have to edit the plugin in the plugins section.

// ----------------------------------------------------
  function wan_error_email($atts) {
    GLOBAL $prefs;
    extract(lAtts(array(
			'user' => '1'
		),$atts));
		$mailtext = "The following error occured on ".$prefs['sitename'];
		$mailtext .= "\nError message: ".error_message(0);
    $mailtext .= "\nPage: http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
    // azw: Conditional added to prevent error message from appearing
    if (isset($_SERVER['HTTP_REFERER']))
    {
      $mailtext .= "\nReferer: ".$_SERVER['HTTP_REFERER'];  
    }
    $mailtext .= "\nIP: ".$_SERVER['REMOTE_ADDR'];
    $subject = substr(error_status(0),0,3).' error on '.$prefs['sitename'];
    $rs = safe_row("email, RealName", 'txp_users', "user_id = $user");
    $email = $rs['email'];
    $header = 'From:'.$rs['RealName'].' <'.$rs['email'].'>'."\r\n";
    @mail($email, $subject, $mailtext, $header);
	}

10/17/08 – edited to add missing “;” after $email = $rs[‘email’]

Last edited by azw (2008-10-17 17:20:31)

Offline

#6 2008-10-17 12:38:50

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: [archived] wan_error_email

azw wrote:

Okay, here’s an easy fix for it.

Thanks, azw. That seems to work for me, except that you’re missing a semicolon after $email = $rs['email']. It caused an error in “Debugging” mode, but I’m not sure it would’ve made a difference in Testing or Live.

Offline

#7 2008-10-17 17:21:44

azw
Member
Registered: 2007-01-29
Posts: 279

Re: [archived] wan_error_email

Yo, boy, thanks for picking up on that typo, Logoleptic! I’ve corrected the post above.

Offline

#8 2009-01-17 08:08:21

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: [archived] wan_error_email

Is this plugin gone? All of wannert.net seems to be 403 and 404 errors. I hope wanni is okay.

Offline

#9 2009-01-17 18:25:24

azw
Member
Registered: 2007-01-29
Posts: 279

Re: [archived] wan_error_email

Here’s the original file:

# wan_error_email v0.1
# Sends an email to the admin if an error occurs
# Martin Wannert
# http://wannert.net/

# ......................................................................
# This is a plugin for Textpattern - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# ......................................................................

YTo5OntzOjQ6Im5hbWUiO3M6MTU6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FuX2Vycm9yX2VtYWlsKCRh
dHRzKSB7CiAgICBHTE9CQUwgJHByZWZzOwoKICAgIGV4dHJhY3QobEF0dHMoYXJyYXkoCgkJ
CSd1c2VyJyA9PiAnMScKCQkpLCRhdHRzKSk7CgoJCSRtYWlsdGV4dCA9ICJUaGUgZm9sbG93
aW5nIGVycm9yIG9jY3VyZWQgb24gIi4kcHJlZnNbJ3NpdGVuYW1lJ107CgkJJG1haWx0ZXh0
IC49ICJcbkVycm9yIG1lc3NhZ2U6ICIuZXJyb3JfbWVzc2FnZSgwKTsKICAgICRtYWlsdGV4
dCAuPSAiXG5QYWdlOiBodHRwOi8vIi4kX1NFUlZFUlsnU0VSVkVSX05BTUUnXS4kX1NFUlZF
UlsnUkVRVUVTVF9VUkknXTsKICAgICRtYWlsdGV4dCAuPSAiXG5SZWZlcmVyOiAiLiRfU0VS
VkVSWydIVFRQX1JFRkVSRVInXTsKICAgICRtYWlsdGV4dCAuPSAiXG5JUDogIi4kX1NFUlZF
UlsnUkVNT1RFX0FERFInXTsKCiAgICAkc3ViamVjdCA9IHN1YnN0cihlcnJvcl9zdGF0dXMo
MCksMCwzKS4nIGVycm9yIG9uICcuJHByZWZzWydzaXRlbmFtZSddOwogICAgJHJzID0gc2Fm
ZV9yb3coImVtYWlsLCBSZWFsTmFtZSIsICd0eHBfdXNlcnMnLCAidXNlcl9pZCA9ICR1c2Vy
Iik7CiAgICAkZW1haWwgPSAkcnNbJ2VtYWlsJ107CgogICAgJGhlYWRlciA9ICdGcm9tOicu
JHJzWydSZWFsTmFtZSddLicgPCcuJHJzWydlbWFpbCddLic+Jy4iXHJcbiI7CiAgICBAbWFp
bCgkZW1haWwsICRzdWJqZWN0LCAkbWFpbHRleHQsICRoZWFkZXIpOwoJfSI7czozOiJtZDUi
O3M6MzI6IjAwMDBiNjQ2NzJkNzFhMTlmYmU3MjNhYmFjZWI1MDQyIjt9

Offline

  1. Index
  2. » Archives
  3. » [archived] wan_error_email

Board footer

Powered by FluxBB