Move the signup app to the optional apps directory.
This commit is contained in:
parent
99e5dfe015
commit
79789ce100
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
//application details
|
||||
$apps[$x]['name'] = "Sign Up";
|
||||
$apps[$x]['uuid'] = 'd308e9c6-d907-5ba7-b3be-6d3e09cf01aa';
|
||||
$apps[$x]['category'] = 'System';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en'] = 'Allows customers on the internet to signup for a user account.';
|
||||
|
||||
//menu details
|
||||
$apps[$x]['menu'][0]['title']['en'] = 'Sign Up';
|
||||
$apps[$x]['menu'][0]['uuid'] = 'a8f49f02-9bfb-65ff-4cd3-85dc3354e4c1';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = '';
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
$apps[$x]['menu'][0]['path'] = '/app/users/usersupdate.php';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'disabled';
|
||||
|
||||
//permission details
|
||||
$apps[$x]['permissions'][0]['name'] = 'signup';
|
||||
?>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?php
|
||||
//Configs for this module... they'll need to be moved to the database
|
||||
|
||||
// Get a key from https://www.google.com/recaptcha/admin/create
|
||||
$publickey = "";
|
||||
$privatekey = "";
|
||||
|
||||
?>
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,178 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/recaptchalib.php";
|
||||
//require_once "includes/email_address_validator.php";
|
||||
include "config.php";
|
||||
include "v_fields.php";
|
||||
|
||||
# the response from reCAPTCHA
|
||||
$resp = null;
|
||||
# the error code from reCAPTCHA, if any
|
||||
$error = null;
|
||||
|
||||
if (count($_POST)>0 && $_POST["persistform"] != "1") {
|
||||
|
||||
$msgerror = '';
|
||||
|
||||
$required[] = array('username', "Please provid a Username.<br>\n");
|
||||
$required[] = array('user_first_name', "Please provide a first name.<br>\n");
|
||||
$required[] = array('user_last_name', "Please provide a last name.<br>\n");
|
||||
$required[] = array('user_billing_address_1', "Please provide a street address.<br>\n");
|
||||
$required[] = array('user_billing_city', "Please provide a city.<br>\n");
|
||||
$required[] = array('user_billing_state_province', "Please provide a state.<br>\n");
|
||||
$required[] = array('user_billing_country', "Please provide a country.<br>\n");
|
||||
$required[] = array('user_billing_postal_code',"Please provide a postal code.<br>\n");
|
||||
$required[] = array('user_phone_1', "Please provide a phone number.<br>\n");
|
||||
$required[] = array('user_email', "Please provide an email address.<br>\n");
|
||||
|
||||
foreach($required as $x) {
|
||||
if (strlen($_REQUEST[$x[0]]) < 1) {
|
||||
$msgerror .= $x[1];
|
||||
$error_fields[] = $x[0];
|
||||
}
|
||||
}
|
||||
|
||||
//sanitize the http request array
|
||||
foreach ($_REQUEST as $field => $data){
|
||||
$request[$field] = check_str($data);
|
||||
}
|
||||
|
||||
//username is already used.
|
||||
if (strlen($request['username']) != 0) {
|
||||
$sql = "SELECT * FROM v_users ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and username = '" . $request['username'] . "' ";
|
||||
$sql .= "and user_enabled = 'true' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
if (count($prep_statement->fetchAll(PDO::FETCH_NAMED)) > 0) {
|
||||
$msgerror .= "Please choose a different Username.<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
// make sure password fields match
|
||||
if ($request['password'] != $request['confirmpassword']) {
|
||||
$msgerror .= "Passwords did not match.<br>\n";
|
||||
}
|
||||
|
||||
// email address atleast looks valid
|
||||
//if (!in_array('user_email', $error_fields)) {
|
||||
// $validator = new EmailAddressValidator;
|
||||
// if (!$validator->check_email_address($request['user_email'])) {
|
||||
// $msgerror .= "Please provide a VALID email address.<br>\n";
|
||||
// }
|
||||
//}
|
||||
|
||||
if ($_POST["recaptcha_response_field"]) {
|
||||
$resp = recaptcha_check_answer ($privatekey,
|
||||
$_SERVER["REMOTE_ADDR"],
|
||||
$_POST["recaptcha_challenge_field"],
|
||||
$_POST["recaptcha_response_field"]);
|
||||
|
||||
if (!$resp->is_valid) {
|
||||
# set the error code so that we can display it
|
||||
$msgerror .= "Captcha Verification Failed<br>\n";
|
||||
$error = $resp->error;
|
||||
}
|
||||
} else {
|
||||
$msgerror .= "Captcha Verification Failed<br>\n";
|
||||
}
|
||||
|
||||
if (strlen($msgerror) > 0) {
|
||||
goto showform;
|
||||
}
|
||||
|
||||
//salt used with the password to create a one way hash
|
||||
$salt = generate_password('20', '4');
|
||||
$user_uuid = uuid();
|
||||
$sql = "insert into v_users ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "user_uuid, ";
|
||||
$sql .= "username, ";
|
||||
$sql .= "password, ";
|
||||
$sql .= "salt, ";
|
||||
$sql .= "user_email, ";
|
||||
$sql .= "add_date, ";
|
||||
$sql .= "add_user ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$user_uuid', ";
|
||||
$sql .= "'" . $request['username'] . "', ";
|
||||
$sql .= "'".md5($salt.$request['password'])."', ";
|
||||
$sql .= "'" . $salt . "', ";
|
||||
$sql .= "'" . $request['user_email'] . "', ";
|
||||
$sql .= "now(), ";
|
||||
$sql .= "'".$_SESSION["username"]."' ";
|
||||
$sql .= ") ";
|
||||
if ($db_type == "pgsql") {
|
||||
|
||||
}
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//log the success
|
||||
//$log_type = 'user'; $log_status='add'; $log_add_user=$_SESSION["username"]; $log_desc= "username: ".$username." user added.";
|
||||
//log_add($db, $log_type, $log_status, $log_desc, $log_add_user, $_SERVER["REMOTE_ADDR"]);
|
||||
|
||||
$group_name = 'user';
|
||||
$sql = "insert into v_group_users ";
|
||||
$sql .= "(";
|
||||
$sql .= "group_user_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "group_name, ";
|
||||
$sql .= "user_uuid ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'" . $domain_uuid . "', ";
|
||||
$sql .= "'" . $group_name . "', ";
|
||||
$sql .= "'" . $user_uuid . "' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"3;url=".PROJECT_PATH."/index.php\">\n";
|
||||
echo "<div align='center'>Add Complete</div>";
|
||||
require_once "includes/footer.php";
|
||||
// This should probably be an exit or die() call;
|
||||
return;
|
||||
}
|
||||
|
||||
showform:
|
||||
|
||||
require_once "includes/header.php";
|
||||
|
||||
include "user_template.php";
|
||||
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
<div align='center'>
|
||||
<table width='90%' border='0' cellpadding='0' cellspacing='2'>
|
||||
<?php if (strlen($msgerror) > 0) { ?>
|
||||
<tr><td>
|
||||
<?php echo $msgerror; ?>
|
||||
</td></tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td align="left">
|
||||
<br>
|
||||
|
||||
<form method='post' action=''>
|
||||
|
||||
<?php foreach($forms as $form) { ?>
|
||||
|
||||
<b><?php echo $form['header']; ?></b><br>
|
||||
<div class='borderlight' style='padding:10px;'>
|
||||
<table width="100%" cellpadding='6' cellspacing='0'>
|
||||
<?php
|
||||
foreach($form['fields'] as $field) {
|
||||
if ($field[3]) {
|
||||
$cssclass = 'vncellreq';
|
||||
} else {
|
||||
$cssclass = 'vncell';
|
||||
}
|
||||
|
||||
if (in_array($field[0], $error_fields)) {
|
||||
$cssclass = 'vncellreqerr';
|
||||
}
|
||||
|
||||
?> <tr><td class="<?php echo $cssclass; ?>" width="40%"><?php echo $field[1]; ?></td>
|
||||
<td class="vtable" width="60%"><input type="<?php echo $field[2]; ?>" class="formfld" autocomplete="off"
|
||||
name="<?php echo $field[0]; ?>" value="<?php echo $request[$field[0]]; ?>"></td></tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
print("</table></div><br>");
|
||||
}
|
||||
?>
|
||||
|
||||
<div class='' style='padding:10px;'>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<!-- <td valign='top'>
|
||||
<input type="checkbox" name="newsletter" value="newsletter" /> Yes, sign me up for news letter<br />
|
||||
<input type="checkbox" name="tos_agree" value="tos_agree" /> I have read and agree to the terms of service
|
||||
</td> -->
|
||||
<td colspan='2' align='center'><?php echo recaptcha_get_html($publickey, $error); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' align='center'>
|
||||
<input type='submit' name='submit' class='btn' value='Create Account'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
// Add/Edit Form Fields
|
||||
$forms[1]['header'] = "Please fill out this form completely. All BOLD fields are required.";
|
||||
$forms[1]['fields'][1] = array('username', "Username:", "text", TRUE, "Please provid a Username.<br>\n");
|
||||
$forms[1]['fields'][2] = array('password', "Password:", "password", TRUE, "Please provid a Username.<br>\n");
|
||||
$forms[1]['fields'][3] = array('confirmpassword', "Confirm Password:", "password", FALSE, "");
|
||||
$forms[1]['fields'][4] = array('user_company_name', "Company Name:", "text", FALSE, "");
|
||||
$forms[1]['fields'][5] = array('user_first_name', "First Name:", "text", TRUE, "Please provide a first name.<br>\n");
|
||||
$forms[1]['fields'][6] = array('user_last_name', "Last Name:", "text", TRUE, "Please provide a last name.<br>\n");
|
||||
$forms[1]['fields'][7] = array('user_email', "Email:", "text", TRUE, "Please provide an email address.<br>\n");
|
||||
$forms[1]['fields'][8] = array('user_phone_1', "Phone Number:", "text", TRUE, "Please provide a phone number.<br>\n");
|
||||
$forms[1]['fields'][9] = array('user_phone_1_ext', "Extension:", "text", FALSE, "");
|
||||
|
||||
$forms[2]['header'] = "Billing Address";
|
||||
$forms[2]['fields'][1] = array('user_billing_address_1', "Address 1:", "text", TRUE, "Please provide a street address.<br>\n");
|
||||
$forms[2]['fields'][2] = array('user_billing_address_2', "Address 2:", "text", FALSE, "");
|
||||
$forms[2]['fields'][3] = array('user_billing_city', "City:", "text", TRUE, "Please provide a city.<br>\n");
|
||||
$forms[2]['fields'][4] = array('user_billing_state_province', "State/Province:", "text", TRUE, "Please provide a state or province.<br>\n");
|
||||
$forms[2]['fields'][5] = array('user_billing_country', "Country:", "text", TRUE, "Please provide a country.<br>\n");
|
||||
$forms[2]['fields'][6] = array('user_billing_postal_code', "ZIP/Postal Code:", "text", TRUE, "Please provide a postal code.<br>\n");
|
||||
|
||||
$forms[3]['header'] = "Shipping Address";
|
||||
$forms[3]['fields'][1] = array('user_shipping_address_1', "Address 1:", "text", TRUE, "Please provide a street address.<br>\n");
|
||||
$forms[3]['fields'][2] = array('user_shipping_address_2', "Address 2:", "text", FALSE, "");
|
||||
$forms[3]['fields'][3] = array('user_shipping_city', "City:", "text", TRUE, "Please provide a city.<br>\n");
|
||||
$forms[3]['fields'][4] = array('user_shipping_state_province', "State/Province:", "text", TRUE, "Please provide a state or province.<br>\n");
|
||||
$forms[3]['fields'][5] = array('user_shipping_country', "Country:", "text", TRUE, "Please provide a country.<br>\n");
|
||||
$forms[3]['fields'][6] = array('user_shipping_postal_code', "ZIP/Postal Code:", "text", TRUE, "Please provide a postal code.<br>\n");
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue