Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - claw

Pages: [1]
1
Mods & Plugins (Releases & Support) / Here is another integration mod...
« on: November 06, 2002, 06:36:31 PM »
I think that is is somewhat troublesome to modify the 4images to use phpbb users db. And I find a lot of trouble to use the group in 4images after I use the previous mod.
Here is my modification that I make my phpbb to create the same user id in 4images.

Below is the patch to make the phpbb2 that will insert the account into 4images. Also, when phpbb activate the account, it will also activate the 4images account.

Code: [Select]

Index: includes/constants.php
===================================================================
diff -Naur includes/constants.php
--- includes/constants.php 2002-07-29 06:04:04.000000000 +0800
+++ includes/constants.php 2002-10-19 02:46:37.000000000 +0800
@@ -178,4 +178,16 @@
 define('VOTE_RESULTS_TABLE', $table_prefix.'vote_results');
 define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');
 
+// Album integration
+$album_table_prefix = '4images_';
+//define('ALBUM_INTEGRATED', 0); // Integrated album off
+define('ALBUM_INTEGRATED', 1); // Integrated album on
+define('ALBUM_USERS_TABLE', $album_table_prefix.'users');
+
+// Album User levels
+define('ALBUM_GUEST', -1);
+define('ALBUM_USER_AWAITING', 1);
+define('ALBUM_USER', 2);
+define('ALBUM_ADMIN', 9);
+
 ?>
Index: includes/usercp_activate.php
===================================================================
diff -Naur includes/usercp_activate.php
--- includes/usercp_activate.php 2002-05-20 01:21:38.000000000 +0800
+++ includes/usercp_activate.php 2002-10-19 03:25:49.000000000 +0800
@@ -56,6 +56,19 @@
  {
  message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql_update);
  }
+ if ( defined('ALBUM_INTEGRATED') )
+ {
+ if (ALBUM_INTEGRATED == 1)
+ {
+ $album_sql = "UPDATE " . ALBUM_USERS_TABLE . "
+ SET user_level = " . ALBUM_USER . "
+ WHERE user_id = " . $row['user_id'] . " AND user_activationkey = '" . $HTTP_GET_VARS['act_key'] . "'";
+ if ( !($result = $db->sql_query($album_sql)) )
+ {
+ message_die(GENERAL_ERROR, 'Could not update album users table', '', __LINE__, __FILE__, $sql_update);
+ }
+ }
+ }
 
  if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN && $sql_update_pass == '' )
  {
Index: includes/usercp_register.php
===================================================================
diff -Naur includes/usercp_register.php
--- includes/usercp_register.php 2002-09-28 12:21:18.000000000 +0800
+++ includes/usercp_register.php 2002-10-18 02:57:36.000000000 +0800
@@ -440,6 +440,13 @@
  {
  message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
  }
+ $album_sql = "UPDATE " . ALBUM_USERS_TABLE . "
+ SET " . $album_username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) ."', user_icq = '" . str_replace("\'", "''", $icq) . "', user_homepage = '" . str_replace("\'", "''", $website) . "', user_showemail = $viewemail, user_invisible = " . (1 - $allowviewonline) . "
+ WHERE user_id = $user_id";
+ if ( !($result = $db->sql_query($album_sql)) )
+ {
+ message_die(GENERAL_ERROR, 'Could not update album users table', '', __LINE__, __FILE__, $sql);
+ }
 
  if ( !$user_active )
  {
@@ -499,6 +506,8 @@
  //
  $sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_active, user_actkey)
  VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popuppm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, ";
+ $album_sql = "INSERT INTO " . ALBUM_USERS_TABLE . " (user_id, user_name, user_password, user_email, user_showemail, user_allowemails, user_invisible, user_joindate, user_lastaction, user_lastvisit, user_comments, user_homepage, user_icq, user_level, user_activationkey)
+ VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', $viewemail, 1, " . (1 - $allowviewonline) . ", " . time() . ", " . time() . ", " . time() . ", 0, '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $icq) . "', ";
  if ( $board_config['require_activation'] == USER_ACTIVATION_SELF || $board_config['require_activation'] == USER_ACTIVATION_ADMIN || $coppa )
  {
  $user_actkey = gen_rand_string(true);
@@ -506,10 +515,14 @@
  $key_len = ( $key_len > 6 ) ? $key_len : 6;
  $user_actkey = substr($user_actkey, 0, $key_len);
  $sql .= "0, '" . str_replace("\'", "''", $user_actkey) . "')";
+ $user_level = ALBUM_USER_AWAITING;
+ $album_sql .= $user_level . ", '" . str_replace("\'", "''", $user_actkey) . "')";
  }
  else
  {
  $sql .= "1, '')";
+ $user_level = ALBUM_USER;
+ $album_sql .= $user_level . ", '')";
  }
 
  if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
@@ -517,6 +530,11 @@
  message_die(GENERAL_ERROR, 'Could not insert data into users table', '', __LINE__, __FILE__, $sql);
  }
 
+ if ( !($result = $db->sql_query($album_sql, BEGIN_TRANSACTION)) )
+ {
+ message_die(GENERAL_ERROR, 'Could not insert data into photo album users table', '', __LINE__, __FILE__, $album_sql);
+ }
+
  $sql = "INSERT INTO " . GROUPS_TABLE . " (group_name, group_description, group_single_user, group_moderator)
  VALUES ('', 'Personal User', 1, 0)";
  if ( !($result = $db->sql_query($sql)) )


2
Mods & Plugins (Releases & Support) / Integration 4images 1.7 / phpBB
« on: October 08, 2002, 08:03:43 PM »
The user level is hard to control with your existing mod. Would you take another approche that you will mod the phpbb2 instead? Say you register in the phpbb2 and automatically insert the user name and password into 4images? That will be better to handle the picture group that has access control.

Pages: [1]