######################################################################### ## MOD Title: CuteNews Integration ## MOD Author: SMKiller2 (N/A) N/A ## MOD Description: This will auto-register the phpBB's users to CuteNews. ## MOD Version: 1.0.0 ## ## Installation Level: Intermediate ## Installation Time: 10 Minutes ## ## Files To Edit: ## admin/admin_users.php ## includes/usercp_register.php ## includes/usercp_activate ## ## Included Files: n/a ## ######################################################################### ## For Security Purposes, Please Check: http://www.phpbb.com/mods/ 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: http://www.phpbb.com/mods/ ######################################################################### ## ## Author Notes: ## ## Copyright's © SMKiller2 ## ## If you have problems with this mod, go to the Cutenews Support ## Forums @ http://www.cutephp.com/forum/ ## ## Thanks goes out to SPyKoN for making it a default PHPBB2 MOD ## and for testing and helping me. ## ######################################################################### ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ######################################################################### ## ## Installation Note: ## Don't FORGET to change the path of your Cutenews directory in ## every code!! And dont add a trailing slash. ## ## Also be sure to backup the files that you have to change before ## installing the MOD. ## ######################################################################### # #-----[ OPEN ]------------------------------------- # admin/admin_users.php # #-----[ FIND ]-------------------------------------- # $sql = "DELETE FROM " . USERS_TABLE . " WHERE user_id = $user_id"; if( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not delete user', '', __LINE__, __FILE__, $sql); } # #-----[ AFTER, ADD ]------------------------- # // CuteNews Integration Hack /* @todo include CuteNews config */ $cutepath = "../../phpBB2 - cutenews"; // Without trailing slash $old_db = file("$cutepath/data/users.db.php"); $new_db = fopen("$cutepath/data/users.db.php", "w"); foreach ($old_db as $old_db_line) { $old_db_arr = explode("|", $old_db_line); if ($username != $old_db_arr[2]) { fwrite($new_db, "$old_db_line"); } } fclose($new_db); // End CuteNews Integration Hack # #-----[ FIND ]-------------------------------------- # if( $result = $db->sql_query($sql) ) { if( isset($rename_user) ) { $sql = "UPDATE " . GROUPS_TABLE . " SET group_name = '".str_replace("\'", "''", $rename_user)."' WHERE group_name = '".str_replace("'", "''", $this_userdata['username'] )."'"; if( !$result = $db->sql_query($sql) ) # #-----[ BEFORE, ADD ]------------------------------------- # // CuteNews Integration Hack /* @todo include CuteNews config */ $cutepath = "../../phpBB2 - cutenews"; // Without trailing slash $old_db = file("$cutepath/data/users.db.php"); $new_db = fopen("$cutepath/data/users.db.php", "w"); foreach ($old_db as $old_db_line) { $old_db_arr = explode("|", $old_db_line); if ($username != $old_db_arr[2]) { fwrite($new_db, "$old_db_line"); } else { if (empty($new_password)) $new_password = $old_db_arr[3]; fwrite($new_db, "$old_db_arr[0]|$old_db_arr[1]|$username|$password|$username|$email|$old_db_arr[6]|$old_db_arr[7]|$old_db_arr[8]|$old_db_arr[9]||\n"); } } fclose($new_db); // End CuteNews Integration Hack # #-----[ OPEN ]--------------------------------------------- # includes/usercp_register.php # #-----[ FIND ]------------------------------------------------ # if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql); } # #-----[ AFTER, ADD ]------------------------------------- # // CuteNews Integration Hack /* @todo include CuteNews config */ $cutepath = "../phpBB2 - cutenews"; // Without trailing slash $old_db = file("$cutepath/data/users.db.php"); $new_db = fopen("$cutepath/data/users.db.php", "w"); foreach ($old_db as $old_db_line) { $old_db_arr = explode("|", $old_db_line); if ($username != $old_db_arr[2]) { fwrite($new_db, "$old_db_line"); } else { if (empty($new_password)) $new_password = $old_db_arr[3]; fwrite($new_db, "$old_db_arr[0]|$old_db_arr[1]|$username|$new_password|$username|$email|$old_db_arr[6]|$old_db_arr[7]|$old_db_arr[8]|$old_db_arr[9]||\n"); } } fclose($new_db); // End CuteNews Integration Hack # #-----[ FIND ]------------------------------------- # $sql .= "1, '')"; # #-----[ AFTER, ADD ]------------------------------------- # // CuteNews Integration Hack /* @todo include CuteNews config */ $cutepath = "../phpBB2 - cutenews"; // Without trailing slash $add_time = time() + ($config_date_adjust * 60); $new_users_file = fopen("$cutepath/data/users.db.php", "a"); fwrite($new_users_file, "$add_time|4|$username|$new_password|$username|$email|0|0||||\n"); fclose($new_users_file); // End CuteNews Integration Hack # #-----[ OPEN ]------------------------------------- # includes/usercp_activate.php # #-----[ FIND ]---------------------------------------- # { message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql_update); } # #-----[ AFTER, ADD ]---------------------------------------- # // CuteNews Integration Hack /* @todo include CuteNews config */ $cutepath = "../phpBB2 - cutenews"; // Without trailing slash $sql = "SELECT user_regdate, username, user_password, user_email FROM " . USERS_TABLE . " WHERE user_id = " . $row['user_id']; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain user information', '', __LINE__, __FILE__, $sql_update); } if (!($cndata = $db->sql_fetchrow($result))) { message_die(GENERAL_MESSAGE, $lang['No_such_user']); } $cndata["user_regdate"] = $cndata["user_regdate"] + ($config_date_adjust * 60); $old_db = file("$cutepath/data/users.db.php"); $new_db = fopen("$cutepath/data/users.db.php", "w"); foreach ($old_db as $old_db_line) { $old_db_arr = explode("|", $old_db_line); if ($cndata["username"] != $old_db_arr[2]) { fwrite($new_db, "$old_db_line"); } else { fwrite($new_db, "{$cndata["user_regdate"]}|$old_db_arr[1]|{$cndata["username"]}|{$cndata["user_password"]}|{$cndata["username"]}|{$cndata["user_email"]}|$old_db_arr[6]|$old_db_arr[7]|$old_db_arr[8]|$old_db_arr[9]||\n"); $cninfowritten = true; } } if (!$cninfowritten) fwrite($new_db, "{$cndata["user_regdate"]}|4|{$cndata["username"]}|{$cndata["user_password"]}|{$cndata["username"]}|{$cndata["user_email"]}|0|0||||\n"); fclose($new_db); // End CuteNews Integration Hack #---------[ Save Close All Files ]------------------------- # # EoM