invitation only

Mods etc.

Moderator: Integra Moderator

invitation only

PostAuthor: Skywalker » Fri Apr 14, 2006 5:43 pm

could somebody make this work with pcp?

Code: Select all
################################################################ MOD Title]http://www.phpbb.com/mods/[/url] for the ## latest version of this MOD. Downloading this MOD from other sites could cause malicious code ## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered ## in our MOD-Database, located at: [url=http://www.phpbb.com/mods/]http://www.phpbb.com/mods/[/url] ################################################################ Author Notes: Borrows some code from the phpBB Rank and Mass Email system. ################################################################ MOD History:  ####   2005-5-24 - Version 1.0.7#### -fixed the emailed link for the groupcp. ######   2005-4-24 - Version 1.0.6#### -removed a few cut'n paste mistakes in the lang fields.######   2005-4-19 - Version 1.0.5#### -fixed an ambiguous "find" in the .mod file. ######   2005-4-19 - Version 1.0.4#### -added mt_srand call for PHP versions <4> $lang['Acc_Admin'],      ##-----[ AFTER, ADD ]------------------------------------------#     //BEGIN Invite Only MOD     "L_INVITE_ONLY" => $lang['Invite_only'],     //END Invite Only MOD##-----[ FIND ]------------------------------------------#     "ACTIVATION_ADMIN_CHECKED" => $activation_admin,  ##-----[ AFTER, ADD ]------------------------------------------#     //BEGIN Invite Only MOD     "INVITATION_ONLY_ENABLE" => $invite_only_yes,     "INVITATION_ONLY_DISABLE" => $invite_only_no,     //END Invite Only MOD  ##-----[ OPEN ]------------------------------------------#includes/constants.php##-----[ FIND ]------------------------------------------#define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');  ##-----[ AFTER, ADD ]------------------------------------------#//BEGIN Invite Only MODdefine('INVITATION_TABLE', $table_prefix.'invitations');define('INVITATION_USER_TABLE', $table_prefix.'invitation_users');//END Invite Only MOD##-----[ OPEN ]------------------------------------------#includes/usercp_register.php##-----[ FIND ]------------------------------------------#function show_coppa()##-----[ IN-LINE FIND ]------------------------------------------#(##-----[ IN-LINE AFTER, ADD ]------------------------------------------#$invite_code, $email##-----[ FIND ]------------------------------------------#"U_AGREE_OVER13" => append_sid("profile.$phpEx?mode=register&agreed=true"),##-----[ IN-LINE FIND ]------------------------------------------#true"##-----[ IN-LINE AFTER, ADD ]------------------------------------------#  .$invite_code . $email##-----[ FIND ]------------------------------------------#"U_AGREE_UNDER13" => append_sid("profile.$phpEx?mode=register&agreed=true&coppa=true"))##-----[ IN-LINE FIND ]------------------------------------------#true"##-----[ IN-LINE AFTER, ADD ]------------------------------------------#  .$invite_code . $email##-----[ FIND ]------------------------------------------#if ( $mode == 'register' && !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']) ){     include($phpbb_root_path . 'includes/page_header.'.$phpEx);##-----[ AFTER, ADD ]------------------------------------------#     //BEGIN Invite Only MOD     $invite_code = ( !empty($HTTP_GET_VARS['invite']) ) ? "&invite=" .  urlencode($HTTP_GET_VARS['invite']) :  '';     /*we could just as well retrieve the address from the database. But this gets the job done too.     (IMHO even better, as it can't be used to leak information))*/     $email = ( !empty($HTTP_GET_VARS['mail']) ) ? "&email=" .  urlencode($HTTP_GET_VARS['mail']) :  '';     //END Invite Only MOD##-----[ FIND ]------------------------------------------#show_coppa();##-----[ IN-LINE FIND ]------------------------------------------#(##-----[ IN-LINE AFTER, ADD ]------------------------------------------#$invite_code, $email##-----[ FIND ]------------------------------------------#$strip_var_list['confirm_code'] = 'confirm_code';##-----[ AFTER, ADD ]------------------------------------------#     //BEGIN Invite Only MOD     $strip_var_list['invitation_code'] = 'invitation_code';     //END Invite Only MOD##-----[ FIND ]------------------------------------------#             $db->sql_freeresult($result);         }     }  ##-----[ AFTER, ADD ]------------------------------------------#     //BEGIN Invite Only MOD     $invite_data = false;     if ($board_config['invite_only'] && $mode == 'register') //Let's check the invitation code they sent us     {         if (!isset($invitation_code) || !preg_match('/^[A-Za-z0-9]+$/', $invitation_code))  //this should get rid of any nasty surprises         {             $invitation_code = '';         }         if (empty($invitation_code))         {             $error = TRUE;             $error_msg .= ( ( isset($error_msg) ) ? '<br>' : '' ) . $lang['Invitation_code_invalid'];         }         else         {                                     $sql = 'SELECT invitation_id, invitation_group, invitation_uses                 FROM ' . INVITATION_TABLE . "                 WHERE (invitation_uses <> '0')                 AND (invitation_code = '" . str_replace("'", "''", $invitation_code) . "')";             if (!($result = $db->sql_query($sql)))             {                 $error = TRUE;                 $error_msg .= ( ( isset($error_msg) ) ? '<br>' : '' ) . INVITATION_TABLE;             }             if ($invite_data = $db->sql_fetchrow($result))             {                 //all OK -do nothing at the moment             }                 else             {                       $error = TRUE;                 $error_msg .= ( ( isset($error_msg) ) ? '<br>' : '' ) . $lang['Invitation_code_invalid'];                 $invite_data = false;             }             $db->sql_freeresult($result);         }     }               //END Invite Only MOD    ##-----[ FIND ]------------------------------------------#                     $emailer->reset();                 }                 $db->sql_freeresult($result);             }##-----[ AFTER, ADD ]------------------------------------------#             //BEGIN Invite Only MOD                 if ($board_config['invite_only'] && !empty($invite_data) ) //OK, the code was good, let's update the invitation table             {                   $uses = (intval($invite_data['invitation_uses']));                 if ($uses != -1)                 {                       $uses -= 1;                 }                   //the escaping shouldn't be vital, but better safe than sorry                 $invite_data['invitation_id'] = str_replace("'", "''", $invite_data['invitation_id']);                 $invite_sql = 'UPDATE ' . INVITATION_TABLE . "                     SET invitation_uses  = '$uses'                     WHERE (invitation_id = '".$invite_data['invitation_id']."')";                       if ( !($result = $db->sql_query($invite_sql)) )                 {                     message_die(GENERAL_ERROR, 'Could not update invitation  table', '', __LINE__, __FILE__, $invite_sql);                 }                 //Remember who used this invite                     $invite_user_sql = 'INSERT INTO ' . INVITATION_USER_TABLE . "                         (user_id, invitation_id)                         VALUES ('".intval($user_id)."', '".$invite_data['invitation_id']."')";                                                                                         if ( !($result = $db->sql_query($invite_user_sql)) )                     {                         message_die(GENERAL_ERROR, 'Could not update invitation user table', '', __LINE__, __FILE__, $invite_user_sql);                     }                     // and auto-join the group, should there be one                     if (!empty($invite_data['invitation_group']))                     {                         $find_group_sql = 'SELECT group_id                               FROM ' . GROUPS_TABLE . "                             WHERE (group_id = '".$invite_data['invitation_group']."')                                 AND (group_single_user = '0')";                                                               if (!($result = $db->sql_query($find_group_sql)))                         {                             $error = TRUE;                             $error_msg .= ( ( isset($error_msg) ) ? '<br>' : '' ) . GROUPS_TABLE;                         }                         $count = $db->sql_numrows($result);                         $db->sql_freeresult($result);                                                 if ($count == 1) //Is  there exactly one group matching the description - more than one should be impossible anyway                         {                                                 $invite_group_sql = "INSERT INTO " . USER_GROUP_TABLE .                                 "(user_id, group_id, user_pending)                                 VALUES ('".intval($user_id) ."', '". intval($invite_data['invitation_group'])."', '1')";                             }                                                       if (!empty($invite_group_sql))                         {                                                                         //drop a note to the group moderator                             if (!($result_insert = $db->sql_query($invite_group_sql)))                             {                                 $error = TRUE;                                 $error_msg .= ( ( isset($error_msg) ) ? '<br>' : '' ) . GROUPS_TABLE;                             }                             $group_sql = "SELECT u.user_email, u.username, u.user_lang, g.group_name                                 FROM ".USERS_TABLE . " u, " . GROUPS_TABLE . " g                                 WHERE (u.user_id = g.group_moderator)                                 AND (g.group_id = '".intval($invite_data['invitation_group'])."')";                             if ( !($group_result = $db->sql_query($group_sql)) )                                     {                                 message_die(GENERAL_ERROR, "Error getting group moderator data", "", __LINE__, __FILE__, $group_sql);                             }                             $moderator = $db->sql_fetchrow($group_result);                               $db->sql_freeresult($group_result);                             //include_once($phpbb_root_path . 'includes/emailer.'.$phpEx);                             $emailer = new emailer($board_config['smtp_delivery']);                                                     $emailer->from($board_config['board_email']);                             $emailer->replyto($board_config['board_email']);                                                         $emailer->use_template('group_request', $moderator['user_lang']);                             $emailer->email_address($moderator['user_email']);                             $emailer->set_subject($lang['Group_request']);                                                         $script_name = preg_replace('/^/?(.*?)/?$/', '1', trim($board_config['script_path']));                             $script_name = ($script_name != '') ? $script_name . '/groupcp.'.$phpEx : 'groupcp.'.$phpEx;                             $server_name = trim($board_config['server_name']);                             $server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';                             $server_port = ($board_config['server_port'] <80>assign_vars(array(                                 'SITENAME' => $board_config['sitename'],                                 'GROUP_MODERATOR' => $moderator['username'],                                 'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br>', "n", "-- n" . $board_config['board_email_sig']) : '',                                                               'U_GROUPCP' => $grouplink . '?' . POST_GROUPS_URL . "=".$invite_data['invitation_group']."&validate=true")                             );                             $emailer->send();                             $emailer->reset();                                                                   }                                                      }                   }                 //END Invite Only MOD ##-----[ FIND ]------------------------------------------#     $template->assign_block_vars('switch_confirm', array());}##-----[ AFTER, ADD ]------------------------------------------#     //BEGIN Invite Only MOD     if (!empty($board_config['invite_only']) && $mode == 'register')     {         $template->assign_block_vars('switch_invitation_only', array());         $invitation_code = ( isset($HTTP_GET_VARS['invite']) ) ? trim($HTTP_GET_VARS['invite']) : ((isset($invitation_code)) ? $invitation_code : ''  ) ;         $invitation_code = htmlspecialchars($invitation_code);         $email = ( isset($HTTP_GET_VARS['email']) ) ? trim($HTTP_GET_VARS['email']) : ((isset($email)) ? $email : ''  ) ;         $email = htmlspecialchars($email);     }       //END Invite Only MOD ##-----[ FIND ]------------------------------------------#         'CONFIRM_IMG' => $confirm_image,  ##-----[ AFTER, ADD ]------------------------------------------#         //BEGIN Invite Only MOD         'INVITATION' => $invitation_code,         //END Invite Only MOD ##-----[ FIND ]------------------------------------------#L_EMAIL_ADDRESS' => $lang['Email_address'],##-----[ AFTER, ADD ]------------------------------------------#         //BEGIN Invite Only MOD         'L_INVITATION' => $lang['Invitation'],         //END Invite Only MOD                              ##-----[ OPEN ]------------------------------------------#language/lang_english/lang_main.php##-----[ FIND ]------------------------------------------#//// That's all, Folks!// -------------------------------------------------##-----[ BEFORE, ADD ]------------------------------------------#//BEGIN Invite Only MOD$lang['Invitation_code_invalid'] = 'The entered Invitation Code is invalid';$lang['Invitation'] = 'Invitation Code';//END Invite Only MOD##-----[ OPEN ]------------------------------------------#language/lang_english/lang_admin.php##-----[ FIND ]------------------------------------------#//// That's all Folks!##-----[ BEFORE, ADD ]------------------------------------------#    //BEGIN Invite Only MOD$lang['Invite_only'] = 'Invitation Only';$lang['Invites_text'] = 'Manage invitation pass codes.';$lang['Invites_title'] = 'Invitations';  $lang['Show'] ='Show';$lang['Filter'] ='Filter';$lang['Show_all'] ='all';$lang['Active'] ='active';$lang['Inactive'] ='inactive';  $lang['Invites_description'] = 'Description'; //this just  happens to be identical in English$lang['Invites_id'] = '#';$lang['Invites_code'] = 'Passcode';$lang['Invite_uses_remaining'] ='Uses left';$lang['Invite_users_used'] ='Users who used this invite';$lang['Invite_group'] ='Auto-join Group';$lang['Invite_uses'] ='Uses';$lang['Invite_uses_explain'] ='Limit the number of users using this invite; '-1' for no limit ';$lang['Infinite'] ='infinite';  $lang['Invite_description'] = 'Description';  $lang['Default_invite_subject'] = 'You have been invited to join ';$lang['Default_invite_message'] = 'Hi, You have been invited to join our community; use the Invitation code  at the end of the message to register at: ';$lang['Invite_email_sent'] = '<br> <b>Invite Email sent to:</b> ';  $lang['Add_new_invite'] = 'Generate Invite';$lang['Add_new_invite_text'] = 'Generate a new invitation passcode. You can also send an invitation e-mail. If you don't want to send a mail, then leave the "Recipient" field blank.';$lang['Invite_email'] = 'Send Invitation E-Mail';$lang['Edit_invite'] = 'Edit Invite';$lang['Edit_invite_text'] = 'Edit an existing invitation passcode.';          $lang['Invitation_generated'] = 'A new Invitation Passcode has been generated. Use the following code to register a new user:';$lang['Must_select_invitation'] = 'You have to select an Invitation';$lang['Click_return_invite_admin'] = 'Click %sHere%s to return to the Invitation Generation Page.';$lang['Invitation_updated']='The invitation has been updated.';$lang['Invite_removed'] ='Invitation deleted';//END Invite Only MOD  ##-----[ OPEN ]------------------------------------------#admin/admin_groups.php# #-----[ FIND ]------------------------------------------#                 message_die(GENERAL_ERROR, 'Could not update user_group', '', __LINE__, __FILE__, $sql);             }##-----[ AFTER, ADD ]------------------------------------------#           //BEGIN Invite Only MOD                 //We don't actually have to update the invite to reflect the deletion of the group, but I like my database consistent         $sql = "UPDATE " . INVITATION_TABLE . "             SET invitation_group='0'             WHERE (invitation_group = $group_id)";         if ( !$db->sql_query($sql) )         {             message_die(GENERAL_ERROR, 'Could not update invitations', '', __LINE__, __FILE__, $sql);         }         //END Invite Only MOD##-----[ OPEN ]------------------------------------------#admin/admin_users.php# #-----[ FIND ]------------------------------------------#if( $HTTP_POST_VARS['deleteuser'] )         {##-----[ AFTER, ADD ]------------------------------------------#             //BEGIN Invite Only MOD             // The user is no more; we do no longer need his/her invitation info. We couldn't use it anyway             $sql = "DELETE FROM " . INVITATION_USER_TABLE . "                 WHERE (user_id = $user_id)";             if( !$db->sql_query($sql) )             {                 message_die(GENERAL_ERROR, 'Could not delete user invitation', '', __LINE__, __FILE__, $sql);             }             //END Invite Only MOD  ##-----[ OPEN ]------------------------------------------#templates/subSilver/profile_add_body.tpl##-----[ FIND ]------------------------------------------#<END> ##-----[ AFTER, ADD ]------------------------------------------#     <BEGIN>     <tr>         <td><span>{L_INVITATION}: * </span><br>         <td><input></td>     </tr>     <END>##-----[ OPEN ]------------------------------------------#templates/subSilver/admin/board_config_body.tpl##-----[ FIND ]------------------------------------------#<td><input>{L_NONE}   <input>{L_USER}   <input>{L_ADMIN}</td>     </tr>##-----[ AFTER, ADD ]------------------------------------------#     <tr>         <td>{L_INVITE_ONLY}</td>         <td><input> {L_ENABLED}  <input> {L_DISABLED}</td>     </tr>  ##-----[ SAVE/CLOSE ALL FILES ]------------------------------------------## EoM                    


Full mod can be found on:
[url=http]http://www.phpbbhacks.com/download/5042[/url]
Last edited by Skywalker on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.

Skywalker
Sr Integra Member
Sr Integra Member
 
Posts: 236
Likes: 0 post
Liked in: 0 post
Joined: Fri Apr 14, 2006 5:25 pm
Cash on hand: 0.00

PostAuthor: setthiscircusdown » Tue Apr 18, 2006 1:56 pm

This would be awesome <img> Anyone working on it please?
Last edited by setthiscircusdown on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.

setthiscircusdown
Members
Members
 
Posts: 42
Likes: 0 post
Liked in: 0 post
Joined: Sat Apr 08, 2006 6:10 pm
Cash on hand: 0.00

PostAuthor: MrDSL » Tue May 30, 2006 10:03 am

Don't really see it happening because the register page in IM is different even from the plain pcp and it was done by ednique and he understands the system much better then I do especially when it comes to the registration page.


Its a bit past my league.
Last edited by MrDSL on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
User avatar
MrDSL
PCP Master
PCP Master
 
Posts: 41
Likes: 0 post
Liked in: 0 post
Joined: Thu Apr 27, 2006 5:34 am
Cash on hand: 0.00

PostAuthor: Skywalker » Tue May 30, 2006 11:05 am

"MrDSL";p="7898" wrote:Don't really see it happening because the register page in IM is different even from the plain pcp and it was done by ednique and he understands the system much better then I do especially when it comes to the registration page.


Its a bit past my league.


where can i find ednique?
Last edited by Skywalker on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.

Skywalker
Sr Integra Member
Sr Integra Member
 
Posts: 236
Likes: 0 post
Liked in: 0 post
Joined: Fri Apr 14, 2006 5:25 pm
Cash on hand: 0.00


Return to IntegraMOD Modifications

Who is online

Registered users: Google [Bot], Majestic-12 [Bot]

cron