Version: 1.0 Release date: 08 July 2003 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. */ require_once("Group-Office.php"); require_once($GO_LANGUAGE->get_base_language_file('users')); //modules user get's access to. //$modules_read = array('products', 'filesystem'); $modules_read = array_map('trim', explode(',',$GO_CONFIG->register_modules_read)); $modules_write = array_map('trim', explode(',',$GO_CONFIG->register_modules_write)); //user groups the user will be added to. $user_groups = array_map('trim',explode(',',$GO_CONFIG->register_user_groups)); //Theme for the user $theme = 'Professional'; //Visible to all users? $visible = false; $task = isset($_POST['task']) ? $_POST['task'] : ''; if(!$GO_CONFIG->allow_registration) { header('Location: '.$GO_CONFIG->host.'error_docs/403.php'); exit(); } $datepicker = new date_picker(); $GO_HEADER['head'] = $datepicker->get_header(); $page_title = $registration_title; if(file_exists($GO_CONFIG->root_path.'login_screens/'.$GO_CONFIG->login_screen.'/login_header.inc')) { require_once($GO_CONFIG->root_path.'login_screens/'.$GO_CONFIG->login_screen.'/login_header.inc'); } require_once($GO_CONFIG->class_path."validate.class.inc"); $val = new validate(); if ($task == "register") { $first_name = smart_addslashes(trim($_POST['first_name'])); $middle_name = smart_addslashes(trim($_POST['middle_name'])); $last_name = smart_addslashes(trim($_POST['last_name'])); $initials = smart_addslashes($_POST["initials"]); $birthday = smart_addslashes($_POST["birthday"]); $email = smart_addslashes($_POST["email"]); $home_phone = smart_addslashes($_POST["home_phone"]); $fax = smart_addslashes($_POST["fax"]); $cellular = smart_addslashes($_POST["cellular"]); $country = smart_addslashes($_POST["country"]); $state = smart_addslashes($_POST["state"]); $city = smart_addslashes($_POST["city"]); $zip = smart_addslashes($_POST["zip"]); $address = smart_addslashes($_POST["address"]); $company = smart_addslashes($_POST["company"]); $title = smart_addslashes($_POST["title"]); $pass1 = smart_stripslashes($_POST["pass1"]); $pass2 = smart_stripslashes($_POST["pass2"]); $username = smart_addslashes($_POST['username']); $val->error_required = $error_required; $val->error_min_length = $error_min_length; $val->error_max_length = $error_max_length; $val->error_expression = $error_email; $val->name="first_name"; $val->input=$first_name; $val->max_length=50; $val->required=true; $val->validate_input(); $val->name="last_name"; $val->input=$last_name; $val->max_length=50; $val->required=true; $val->validate_input(); $val->name="address"; $val->input=$last_name; $val->max_length=50; $val->required=true; $val->validate_input(); $val->name="zip"; $val->input=$last_name; $val->max_length=50; $val->required=true; $val->validate_input(); $val->name="city"; $val->input=$last_name; $val->max_length=50; $val->required=true; $val->validate_input(); $val->name="state"; $val->input=$last_name; $val->max_length=50; $val->required=true; $val->validate_input(); $val->name="country"; $val->input=$last_name; $val->max_length=50; $val->required=true; $val->validate_input(); $val->name="username"; $val->input=$username; $val->min_length=3; $val->max_length=20; $val->required=true; $val->validate_input(); $val->name="pass1"; $val->input=$pass1; $val->min_length=3; $val->max_length=20; $val->required=true; $val->validate_input(); $val->name="pass2"; $val->input=$pass2; $val->min_length=3; $val->max_length=20; $val->required=true; $val->validate_input(); $val->name="email"; $val->input=$_POST['email']; $val->max_length=75; if (!isset($_POST['create_email'])) { $val->required=true; } $val->expression="^([a-z0-9]+)([._-]([a-z0-9]+))*[@]([a-z0-9]+)([._-]([a-z0-9]+))*[.]([a-z0-9]){2}([a-z0-9])?([a-z0-9])?$"; $val->validate_input(); $val->error_match = $error_match_pass; $val->name="pass1"; $val->match1=$_POST['pass1']; $val->match2=$_POST['pass2']; $val->validate_input(); if (!$val->validated) { $error ="

".$errors_in_form."

"; //check if username already exists }elseif($GO_USERS->get_user_by_username($_POST['username'])) { $error = "

".$error_username_exists."

"; //check if email is already registered }elseif($GO_USERS->email_exists($_POST['email'])) { $error = "

".$error_email_exists."

"; }else { $birthday = date_to_db_date($_POST['birthday']); $email = ($_POST['email'] == '') ? $_POST['username'].'@'.$GO_CONFIG->inmail_host : $_POST['email']; //register the new user. function returns new user_id or -1 on failure. if ($new_user_id = $GO_USERS->add_user($username,$pass1, $first_name, $middle_name, $last_name, $initials, $title, $_POST['sex'], $birthday, $email, '', $home_phone, $fax, $cellular, $country, $state, $city, $zip, $address, $company, '', '', '', '', '', '', '', '', '', $_POST['SET_LANGUAGE'], $GO_CONFIG->theme, '', $visible )) { //send email to the user with password $registration_mail_body = str_replace("%sex%", $sir_madam[$_POST['sex']], $registration_mail_body); // If $title is not set, then use $sex (sir_madam) instead for $title. $registration_mail_body = str_replace("%title%", ( ($title != '') ? $title : $sir_madam[$_POST['sex']] ), $registration_mail_body); $registration_mail_body = str_replace("%last_name%", $_POST['last_name'], $registration_mail_body); $registration_mail_body = str_replace("%middle_name%", $middle_name, $registration_mail_body); $registration_mail_body = str_replace("%first_name%", $_POST['first_name'], $registration_mail_body); $registration_mail_body = str_replace("%username%",$_POST['username'], $registration_mail_body); $registration_mail_body = str_replace("%password%",$_POST['pass1'], $registration_mail_body); $registration_mail_body = str_replace("%groupoffice_title%",$GO_CONFIG->title, $registration_mail_body); $registration_mail_body .= "\n\n".$GO_CONFIG->full_url; $registration_mail_subject = str_replace("%groupoffice_title%",$GO_CONFIG->title, $registration_mail_subject); sendmail($email, $GO_CONFIG->webmaster_email, $GO_CONFIG->title, $registration_mail_subject, $registration_mail_body); if(isset($user_groups)) { while($group_id = array_shift($user_groups)) { $GO_GROUPS->add_user_to_group($new_user_id, $group_id); } } //set module permissions while($module_name = array_shift($modules_read)) { if($module = $GO_MODULES->get_module($module_name)) { $GO_SECURITY->add_user_to_acl($new_user_id, $module['acl_read']); } } while($module_name = array_shift($modules_write)) { if($module = $GO_MODULES->get_module($module_name)) { $GO_SECURITY->add_user_to_acl($new_user_id, $module['acl_write']); } } //create Group-Office home directory $old_umask = umask(000); mkdir($GO_CONFIG->file_storage_path.$username, $GO_CONFIG->create_mode); umask($old_umask); //confirm registration to the user and exit the script so the form won't load echo $registration_success." ".$email.""; echo '

'; $link = 'index.php?username='.$_POST['username']; if(isset($_REQUEST['return_to'])) { $link .= '&return_to='.urlencode($_REQUEST['return_to']); } $button = new button($cmdLogin, "javascript:document.location='".$link."';"); require_once($GO_CONFIG->root_path.'login_screens/'.$GO_CONFIG->login_screen.'/login_footer.inc'); exit(); }else { $error = "

".$registration_failure."

"; } } } if ($GO_USERS->max_users_reached()) { echo '

'.$max_user_limit.'

'.$max_users_text; require_once($GO_THEME->theme_path."footer.inc"); exit(); } ?>
'; } ?>

title, $registration_title); ?>

error["first_name"])) { ?> error["last_name"])) { ?> error["address"])) { ?> error["zip"])) { ?> error["city"])) { ?> error["state"])) { ?> error["country"])) { ?> error["email"])) { ?> error["username"])) { ?> error["pass1"])) { ?> error["pass2"])) { ?>
get_languages(); while($language = array_shift($languages)) { $dropbox->add_value($language['code'], $language['description']); } $dropbox->print_dropbox("SET_LANGUAGE", $GO_LANGUAGE->language['code'], 'onchange="javascript:document.forms[0].submit();"'); ?>
error["first_name"]; ?>
*: 
error["last_name"]; ?>
*: 
/  / 
: add_option('M', $strSexes['M']); echo ' '; $radiolist->add_option('F', $strSexes['F']); ?>
: print_date_picker('birthday', $GO_CONFIG->date_formats[0], $birthday); ?>
 
error["address"]; ?>
*: 
error["zip"]; ?>
*: 
error["city"]; ?>
*: 
error["state"]; ?>
*: 
error["country"]; ?>
error["email"]; ?>
*: 
 
error["username"]; ?>
*: 
error["pass1"]; ?>
*: 
error["pass2"]; ?>
*: 
 



root_path.'login_screens/'.$GO_CONFIG->login_screen.'/login_footer.inc')) { require_once($GO_CONFIG->root_path.'login_screens/'.$GO_CONFIG->login_screen.'/login_footer.inc'); } ?>