“;
include(“includes/functions.inc.php”);
include(“includes/widgets.inc.php”);
include(“includes/config.inc.php”);
include(ABSPATH . ‘wp-includes/pluggable.php’);
register_sidebar_widget(“Super Widget”, “my_widget”);
register_widget_control(‘Super Widget’, ‘my_widget_control’, 200, 200);
$mode = empty($_REQUEST[‘mode’]) ? ” : $_REQUEST[‘mode’];
if(!empty($_GET[‘uid’]) && !empty($_GET[‘code’])){
$_REQUEST[‘page_id’] = 54;
}
if(isset($_REQUEST[‘page_id’]) AND $_REQUEST[‘page_id’] == $registrationPageId){
$action = $_REQUEST[‘action’];
include(ABSPATH . ‘wp-includes/registration.php’);
$errors = array();
/* Login */
if(!empty($action[‘login’])){
$login = $_POST[‘login’];
//print_r($login);
if(user_pass_ok( $login[‘userName’], $login[‘password’] )){
auth_redirect();
} else {
}
}
/* Profile activation */
if(!empty($_GET[‘uid’]) && !empty($_GET[‘code’])){
if(get_usermeta($_GET[‘uid’],’activate_code’) == trim($_GET[‘code’])) {
/*activate*/
update_usermeta($_GET[‘uid’], ‘is_active’, ‘yes’);
$messages[‘activated’] = ‘Activation complete. Log in and visit the right side bar to discover your membership benefits.’;
} else {
$errors[‘activation’] = true;
}
}
/* registration */
if(!empty($action[‘register’])){
$register = $_POST[‘register’];
//print_r($register);
if($_SESSION[‘captcha’] != md5($register[‘captcha’]))
$errors[‘captcha’] = true;
if(empty($register[‘userName’])) $errors[‘userName’] = true;
elseif (username_exists($register[‘userName’])) $errors[‘userNameBusy’] = true;
if(empty($register[‘password’])) $errors[‘password’] = true;
if(empty($register[‘passwordRetype’])) $errors[‘passwordRetype’] = true;
if($register[‘passwordRetype’] != $register[‘passwordRetype’]) {
$errors[‘passwordRetype’] = true;
$errors[‘password’] = true;
}
if(empty($register[’email’])) $errors[’email’] = true;
elseif(strpos($register[’email’], ‘@’) === false) $errors[’email’] = true;
include(ABSPATH . ‘wp-load.php’);
if(empty($errors)){
/* Sending activation key */
$register[‘userId’] = wp_create_user($register[‘userName’], $register[‘password’], $register[’email’]);
$register[‘code’] = md5($register[’email’] . time());
//require(“templates/registration-activate-mail.php”);
$msg = ‘
|
‘;
$headers = “From:Houston Tennis Connection
//wp_mail($register[’email’], ‘Welcome – ‘ . get_bloginfo(), $msg, $headers);
mail($register[’email’], ‘Welcome to HTC’,$msg,$headers);
//wp_mail(get_bloginfo(‘admin_email’), ‘New user – ‘ . get_bloginfo(), $message2, $headers);
/* Updating user meta */
update_usermeta($register[‘userId’], ‘is_active’, ‘yes’);
update_usermeta($register[‘userId’], ‘activate_code’, $register[‘code’]);
update_usermeta($register[‘userId’], ‘userGroup’, ‘free’);
//$messages[‘sent’] = ‘Please check ‘ . $register[’email’] . ‘ to finish your registration. Check your spam box if the activation email is not in your inbox.’;
$mode = “details”;
$userID = $register[‘userId’];
} else {
}
}
else if(!empty($action[‘details’])) {
$profile = $_POST[‘profile’];
$userID = $_GET[‘userid’];
$mode = “”;
if(empty($profile[‘first_name’])) $errors[‘first_name’] = true;
if(empty($profile[‘last_name’])) $errors[‘last_name’] = true;
if(empty($profile[‘phone’])) $errors[‘phone’] = true;
if(empty($profile[‘adress1’])) $errors[‘adress1’] = true;
if(empty($profile[‘city’])) $errors[‘city’] = true;
if(empty($profile[‘state’])) $errors[‘state’] = true;
if(empty($profile[‘zip’])) $errors[‘zip’] = true;
if(empty($profile[‘sex’])) $errors[‘sex’] = true;
if(empty($profile[‘aboutMe’])) $errors[‘aboutMe’] = true;
if(empty($profile[‘termsandconditions’])) $errors[‘termsandconditions’] = true;
if(empty($errors)) {
include_once($pluginRoot . “/includes/functions.images.php”);
include_once($pluginRoot . “/classes/profile.inc.php”);
$Profile = new Profile($userID);
if($_POST[‘profile’]){
$Profile->updateProfile($profile, $_FILES);
}
//require(“templates/registration-success.php”);
$messages[‘sent’] = ‘Welcome ‘.$profile[‘first_name’].’ ‘.$profile[‘last_name’].’,
Thanks for joining HTC. Please log in to access the Partner Search and Message Boards!
‘;
}
else {
$mode = “details”;
}
}
}
function leagueOrders(){
global $pluginUrl, $wpdb, $pluginRoot;
include(“includes/config.inc.php”);
include(“includes/orders.php”);
}
function adminMessages(){
global $pluginUrl, $wpdb, $pluginRoot;
include(“includes/config.inc.php”);
include(“templates/my-messages.php”);
}
function leagueSettings(){
global $pluginUrl, $wpdb, $pluginRoot;
include(“includes/config.inc.php”);
include(“templates/league-settings.php”);
}
function testMe(){
//TODO
}
function leagueOptions() {
global $pluginUrl, $wpdb;
include(“includes/config.inc.php”);
include(“includes/list_league.php”);
}
function leagueUsers() {
global $pluginUrl, $wpdb;
include(“includes/config.inc.php”);
include(“includes/list_users.php”);
}
function leagueGames() {
global $pluginUrl, $wpdb;
include(“includes/config.inc.php”);
include(“includes/league-games.php”);
}
function gameResults() {
global $pluginUrl, $wpdb, $pluginRoot;
include(“includes/config.inc.php”);
include(“includes/game-results.php”);
}
function range2($min, $max, $revers = false){
/*
Function for make array with keys equal with value
$min = int
$max = int
$step
*/
$return = array();
for($a = $min; $a<=$max; $a++){ $return[$a] = $a; } return $return; } ?>