Changeset 1566 for trunk


Ignore:
Timestamp:
Oct 19, 2006, 11:33:43 PM (18 years ago)
Author:
rvelices
Message:

feature 563: send an email to admin when new user registers (optional)

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/config_default.inc.php

    r1565 r1566  
    502502$conf['nbm_treatment_timeout_default'] = 20;
    503503
     504// Send an email to the webmaster when a new user registers
     505$conf['email_admin_on_new_user']=false;
     506
    504507// +-----------------------------------------------------------------------+
    505508// | Set default admin layout                                              |
  • trunk/include/functions_url.inc.php

    r1562 r1566  
    5353
    5454/**
     55 * returns the url of the current host (e.g. http://www.toto.com )
     56 * TODO: if required by someone, treat https case
     57 */
     58function get_host_url()
     59{
     60  $url = "http://";
     61  $url .= $_SERVER['HTTP_HOST'];
     62  if ($_SERVER['SERVER_PORT']!=80)
     63  {
     64    $url .= ':'.$_SERVER['SERVER_PORT'];
     65  }
     66  return $url;
     67}
     68
     69/**
    5570 * adds one or more _GET style parameters to an url
    5671 * example: add_url_params('/x', array('a'=>'b')) returns /x?a=b
  • trunk/register.php

    r1565 r1566  
    4949  {
    5050    $user_id = get_userid($_POST['login']);
     51    log_user( $user_id, false);
     52
     53    if ($conf['email_admin_on_new_user'])
     54    {
     55      include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
     56      $username = $_POST['login'];
     57      $admin_url = get_host_url().cookie_path()
     58        .'admin.php?page=user_list&username='.$username;
     59
     60      $content =
     61        'User: '.$username."\n"
     62        .'Mail: '.$_POST['mail_address']."\n"
     63        .'IP: '.$_SERVER['REMOTE_ADDR']."\n"
     64        .'Browser: '.$_SERVER['HTTP_USER_AGENT']."\n\n"
     65        .l10n('admin').': '.$admin_url;
     66
     67      pwg_mail( get_webmaster_mail_address(), '',
     68          'PWG '.l10n('register_title').' '.$username,
     69          $content
     70          );
     71    }
    5172    redirect(make_index_url());
    5273  }
Note: See TracChangeset for help on using the changeset viewer.