[Affelio-cvs 1081] CVS update: affelio/lib/Affelio/SNS

Back to archive index

Tadashi Okoshi slash****@users*****
2006年 2月 23日 (木) 21:41:38 JST


Index: affelio/lib/Affelio/SNS/FriendManager.pm
diff -u affelio/lib/Affelio/SNS/FriendManager.pm:1.18 affelio/lib/Affelio/SNS/FriendManager.pm:1.19
--- affelio/lib/Affelio/SNS/FriendManager.pm:1.18	Mon Dec 19 16:10:20 2005
+++ affelio/lib/Affelio/SNS/FriendManager.pm	Thu Feb 23 21:41:38 2006
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: FriendManager.pm,v 1.18 2005/12/19 07:10:20 slash5234 Exp $
+# $Id: FriendManager.pm,v 1.19 2006/02/23 12:41:38 slash5234 Exp $
 
 package Affelio::SNS::FriendManager;
 {
@@ -57,7 +57,7 @@
 
 	##############################
 	#retrieve all friend records from DB
-	my $query = 'SELECT count(*) FROM AFuser_CORE_friends'; #
+	my $query = "SELECT count(*) FROM $af->{site__dbtbl_prefix}_CORE_friends"; #
 	my $sth;
 	eval{
 	    $sth = $af->getDB->prepare($query);
@@ -80,7 +80,7 @@
 
 	##############################
 	#retrieve all friend records from DB
-	my $query = 'SELECT count(*) FROM AFuser_CORE_friendsfriends'; #
+	my $query = "SELECT count(*) FROM $af->{site__dbtbl_prefix}_CORE_friendsfriends"; #
 	my $sth;
 	eval{
 	    $sth = $af->getDB->prepare($query);
@@ -121,7 +121,7 @@
 	#If so, we DO NOT ignore him. 
 	#We have to update his information.
 	#
-	$query = "SELECT uid FROM AFuser_CORE_friends WHERE af_id = '$af_id'";
+	$query = "SELECT uid FROM $af->{site__dbtbl_prefix}_CORE_friends WHERE af_id = '$af_id'";
 	eval{
 	    $sth = $af->getDB->prepare($query);
 	    $sth->execute();
@@ -135,7 +135,7 @@
 
 	    Affelio::misc::Debug::debug_print("FM::add_friend: Already my friend!");
 	      
-	      $query = "update AFuser_CORE_friends set timestamp = '$timestamp', password = '$password' where af_id = '$af_id'";
+	      $query = "update $af->{site__dbtbl_prefix}_CORE_friends set timestamp = '$timestamp', password = '$password' where af_id = '$af_id'";
 	      eval{
 		  $sth = $af->getDB->prepare($query);
 		  $sth->execute();
@@ -152,7 +152,7 @@
 
 	##############################
 	#Get existing max ID
-	$query = 'SELECT max(uid) FROM AFuser_CORE_friends';
+	$query = "SELECT max(uid) FROM $af->{site__dbtbl_prefix}_CORE_friends";
 	eval{
 	    $sth = $af->getDB->prepare($query);
 	    $sth->execute();
@@ -173,7 +173,7 @@
 	##############################
 	#Is $af_id already in F2 table?
 	#If so, we have to move it from F2 table to F1 table.
-	$query = "SELECT * FROM AFuser_CORE_friendsfriends WHERE af_id = '$af_id'";
+	$query = "SELECT * FROM $af->{site__dbtbl_prefix}_CORE_friendsfriends WHERE af_id = '$af_id'";
 	eval{
 	    $sth = $af->getDB->prepare($query);
 	    $sth->execute();
@@ -196,7 +196,7 @@
 	    $old_f1list_in_f2tbl = $row[4];
 
 	    #Delete the record in the F2 table.
-	    $query = "DELETE FROM AFuser_CORE_friendsfriends WHERE uid = $old_uid_in_f2tbl";
+	    $query = "DELETE FROM $af->{site__dbtbl_prefix}_CORE_friendsfriends WHERE uid = $old_uid_in_f2tbl";
 	    eval{
 		$sth = $af->getDB->prepare($query);
 		$sth->execute();
@@ -210,7 +210,7 @@
 	    # from $old_uid_in_f2tbl  to  $newid
 	    #   update sample set data=translate(data,'b','z')
 	    db_value_replace($af->getDB,
-			     "AFuser_CORE_friendsfriends",
+			     "$af->{site__dbtbl_prefix}_CORE_friendsfriends",
 			     "uid",
 			     "f1list",
 			     ",$old_uid_in_f2tbl," ,
@@ -218,7 +218,7 @@
 			     );
 
 	    db_value_replace($af->getDB,
-			     "AFuser_CORE_friends",
+			     "$af->{site__dbtbl_prefix}_CORE_friends",
 			     "uid",
 			     "f2list",
 			     ",$old_uid_in_f2tbl," ,
@@ -231,7 +231,7 @@
 
 	##############################
 	#Insert a new record into my F1 list.
-	$query = "insert into AFuser_CORE_friends(uid, af_id, nickname, timestamp, password, intro, option_pid,lastupdated,f2list) values ($newid, '$af_id', '$nickname', $timestamp, '$password', ' ', -1, 0, '$old_f1list_in_f2tbl')";
+	$query = "insert into $af->{site__dbtbl_prefix}_CORE_friends(uid, af_id, nickname, timestamp, password, intro, option_pid,lastupdated,f2list) values ($newid, '$af_id', '$nickname', $timestamp, '$password', ' ', -1, 0, '$old_f1list_in_f2tbl')";
 	eval{
 	    $sth = $af->getDB->prepare($query);
 	    $sth->execute();
@@ -257,7 +257,7 @@
 	Affelio::misc::Debug::debug_print("FM::remove_friend:start.");
 
 	#Remove entry(uid) from AFuser_CORE_friends
-	my $q1 = "DELETE FROM AFuser_CORE_friends WHERE uid = $uid";
+	my $q1 = "DELETE FROM $af->{site__dbtbl_prefix}_CORE_friends WHERE uid = $uid";
 	my $s1;
 	eval{
 	    $s1 = $af->getDB->prepare($q1);
@@ -272,7 +272,7 @@
 	
 	#Remove uid from friends of others in AFuser_CORE_friends
 	db_value_replace($af->getDB,
-			 "AFuser_CORE_friends",
+			 "$af->{site__dbtbl_prefix}_CORE_friends",
 			 "uid",
 			 "f2list",
 			 ",$uid," ,
@@ -282,7 +282,7 @@
 
 	#Remove uid from friends of others in AFuser_CORE_friendsfriends
 	db_value_replace($af->getDB,
-			 "AFuser_CORE_friendsfriends",
+			 "$af->{site__dbtbl_prefix}_CORE_friendsfriends",
 			 "uid",
 			 "f1list",
 			 ",$uid," ,
@@ -320,7 +320,7 @@
 		= split(" ", $thisdata);
 	    
 	    #If the AF_ID is mine, ignore it.
-	    if($f2_af_id eq $af->{site__web_root}){
+	    if($f2_af_id eq $af->{site__user_afid}){
 		next;
 	    }
 	    
@@ -355,7 +355,7 @@
 		Affelio::misc::Debug::debug_print("FM::save_F2list: F1's F2list = [$f1_f2list]");
 		
 		#The guy with F2_AF_ID is in the Friend table?
-		$query = "SELECT uid, f2list  FROM AFuser_CORE_friends WHERE af_id = '$f2_af_id'";
+		$query = "SELECT uid, f2list  FROM $af->{site__dbtbl_prefix}_CORE_friends WHERE af_id = '$f2_af_id'";
 		eval{
 		    $sth = $af->getDB->prepare($query);
 		    $sth->execute();
@@ -384,7 +384,7 @@
 		      #Add $f2_uid into $f1_af_id's F2list
 		      $new_f1_f2list = $f1_f2list . $f2_uid . ",";
 		      Affelio::misc::Debug::debug_print("FM::save_F2List: \tnew_f1_f2list=[$new_f1_f2list]");
-		      $query2 = "update AFuser_CORE_friends set f2list = '$new_f1_f2list' where uid = '$f1_uid'";
+		      $query2 = "update $af->{site__dbtbl_prefix}_CORE_friends set f2list = '$new_f1_f2list' where uid = '$f1_uid'";
 		      eval{
 			  $sth2 = $af->getDB->prepare($query2);
 			  $sth2->execute();
@@ -399,7 +399,7 @@
 		      #Add $f1_af_id into $f2_uid's F1list
 		      $new_f2_f1list = $f2_f1list . $f1_uid . ",";
 		      Affelio::misc::Debug::debug_print("FM::save_F2List: \tnew_f2_f1list=[$new_f2_f1list]");
-		      $query2 = "update AFuser_CORE_friends set f2list = '$new_f2_f1list' where uid = $f2_uid";
+		      $query2 = "update $af->{site__dbtbl_prefix}_CORE_friends set f2list = '$new_f2_f1list' where uid = $f2_uid";
 		      eval{
 			  $sth2 = $af->getDB->prepare($query2);
 			  $sth2->execute();
@@ -414,7 +414,7 @@
 		      my $sth2="";
 
 		      #The guy with F2_AF_ID is in the FriendsFriends table?
-		      $query2 = "SELECT * FROM AFuser_CORE_friendsfriends WHERE af_id = '$f2_af_id'";
+		      $query2 = "SELECT * FROM $af->{site__dbtbl_prefix}_CORE_friendsfriends WHERE af_id = '$f2_af_id'";
 		      eval{
 			  $sth2 = $af->getDB->prepare($query2);
 			  $sth2->execute();
@@ -435,7 +435,7 @@
 			    
 			    ##############################
 			    #Get existing min ID
-			    $query3 = 'SELECT min(uid) FROM AFuser_CORE_friendsfriends';
+			    $query3 = "SELECT min(uid) FROM $af->{site__dbtbl_prefix}_CORE_friendsfriends";
 			    eval{
 				$sth3 = $af->getDB->prepare($query3);
 				$sth3->execute();
@@ -455,7 +455,7 @@
 			    ##############################
 			    #Insert a new record
 			    my $tmpnewid = $minid-1;
-			    $query3 = "insert into AFuser_CORE_friendsfriends (uid, af_id, nickname, timestamp, f1list) values ('$tmpnewid', '$f2_af_id', '$nickname', $timestamp, ',')";
+			    $query3 = "insert into $af->{site__dbtbl_prefix}_CORE_friendsfriends (uid, af_id, nickname, timestamp, f1list) values ('$tmpnewid', '$f2_af_id', '$nickname', $timestamp, ',')";
 			    eval{
 				$sth3 = $af->getDB->prepare($query3);
 				$sth3->execute();
@@ -482,7 +482,7 @@
 		      #Add $f2_uid into $f1_af_id's F2list
 		      $new_f1_f2list = $f1_f2list . $f2_uid . ",";
 		      Affelio::misc::Debug::debug_print("FM::save_F2List:\tnew_f1_f2list=[$new_f1_f2list]");
-		      $query2 = "update AFuser_CORE_friends set f2list = '$new_f1_f2list' where uid = $f1_uid";
+		      $query2 = "update $af->{site__dbtbl_prefix}_CORE_friends set f2list = '$new_f1_f2list' where uid = $f1_uid";
 		      eval{
 			  $sth2 = $af->getDB->prepare($query2); 
 			  $sth2->execute();
@@ -495,7 +495,7 @@
 		      #Add $f1_af_id into $f2_uid's F1list
 		      $new_f2_f1list = $f2_f1list . $f1_uid . ",";
 		      Affelio::misc::Debug::debug_print("FM::save_F2List:\tnew_f2_f1list=[$new_f2_f1list]");
-		      $query2 = "update AFuser_CORE_friendsfriends set f1list = '$new_f2_f1list' where uid = $f2_uid";
+		      $query2 = "update $af->{site__dbtbl_prefix}_CORE_friendsfriends set f1list = '$new_f2_f1list' where uid = $f2_uid";
 		      eval{
 			  $sth2 = $af->getDB->prepare($query2);
 			  $sth2->execute();
@@ -541,7 +541,7 @@
 
 	##############################
 	#retrieve a friend record from DB
-	my $query = "SELECT af_id, timestamp, nickname FROM AFuser_CORE_friends WHERE timestamp > " . $req_timestamp;
+	my $query = "SELECT af_id, timestamp, nickname FROM $af->{site__dbtbl_prefix}_CORE_friends WHERE timestamp > " . $req_timestamp;
 	my $sth;
 	eval{
 	    $sth = $af->getDB->prepare($query); 
@@ -591,7 +591,7 @@
 
 	##############################
 	#retrieve all friend records from DB
-	my $query = "SELECT uid, af_id, nickname, timestamp, password, intro, option_pid, lastupdated, f2list, last_news_in, last_news_out FROM AFuser_CORE_friends  $where_block  order by $sort $order";
+	my $query = "SELECT uid, af_id, nickname, timestamp, password, intro, option_pid, lastupdated, f2list, last_news_in, last_news_out FROM $af->{site__dbtbl_prefix}_CORE_friends  $where_block  order by $sort $order";
 	debug_print("FM::get_all_friend_list: query=[$query]");
 	my $sth;
 	eval{
@@ -620,7 +620,7 @@
 
 	##############################
 	#retrieve a friend record from DB
-	my $query = "SELECT uid, af_id, nickname, timestamp, password, intro, option_pid, lastupdated, f2list, last_news_in, last_news_out FROM AFuser_CORE_friends WHERE uid = $uid";
+	my $query = "SELECT uid, af_id, nickname, timestamp, password, intro, option_pid, lastupdated, f2list, last_news_in, last_news_out FROM $af->{site__dbtbl_prefix}_CORE_friends WHERE uid = $uid";
 	my $sth;
 	eval{
 	    $sth = $af->getDB->prepare($query);
@@ -649,7 +649,7 @@
 
 	##############################
 	#retrieve a friend record from DB
-	my $query = "SELECT uid, af_id, nickname, timestamp, password, intro, option_pid, lastupdated, f2list, last_news_in, last_news_out FROM AFuser_CORE_friends WHERE af_id = '$af_id'";
+	my $query = "SELECT uid, af_id, nickname, timestamp, password, intro, option_pid, lastupdated, f2list, last_news_in, last_news_out FROM $af->{site__dbtbl_prefix}_CORE_friends WHERE af_id = '$af_id'";
 	my $sth;
 	eval{
 	    $sth = $af->getDB->prepare($query);
@@ -678,7 +678,7 @@
 	##############################
 	#retrieve a friend record from DB
 	Affelio::misc::Debug::debug_print("FM::get_attr_by_uid(uid=$uid, attr=$attr)");
-	my $query = "SELECT $attr FROM AFuser_CORE_friends WHERE uid = '$uid'";
+	my $query = "SELECT $attr FROM $af->{site__dbtbl_prefix}_CORE_friends WHERE uid = '$uid'";
 	my $sth;
 	eval{
 	    $sth = $af->getDB->prepare($query);
@@ -705,7 +705,7 @@
 
 	##############################
 	#retrieve a friend record from DB
-	my $query = "SELECT $attr FROM AFuser_CORE_friendsfriends WHERE uid = $uid";
+	my $query = "SELECT $attr FROM $af->{site__dbtbl_prefix}_CORE_friendsfriends WHERE uid = $uid";
 	my $sth;
 	eval{
 	    $sth = $af->getDB->prepare($query);
@@ -731,7 +731,7 @@
 	
 	##############################
 	#retrieve a friend record from DB
-	my $query = "SELECT $attr FROM AFuser_CORE_friends WHERE af_id like $af_id";
+	my $query = "SELECT $attr FROM $af->{site__dbtbl_prefix}_CORE_friends WHERE af_id like $af_id";
 	debug_print("FriendManager::get_atr_by_afid: [$query]");
 
 	my $sth;
@@ -772,7 +772,7 @@
 
 	##############################
 	#set value into DB
-	my $query = "update AFuser_CORE_friends set $attr = $value where af_id like $af_id";
+	my $query = "update $af->{site__dbtbl_prefix}_CORE_friends set $attr = $value where af_id like $af_id";
 	my $sth;
 	eval{
 	    $sth = $af->getDB->prepare($query);
@@ -796,7 +796,7 @@
 
 	##############################
 	#set value into DB
-	my $query = "update AFuser_CORE_friends set $attr = $attr + 1 where af_id like $af_id";
+	my $query = "update $af->{site__dbtbl_prefix}_CORE_friends set $attr = $attr + 1 where af_id like $af_id";
 	my $sth;
 	eval{
 	    $sth = $af->getDB->prepare($query);
@@ -826,7 +826,7 @@
 
 	##############################
 	#set value into DB
-	my $query = "update AFuser_CORE_friends set $attr = $value where uid = $uid";
+	my $query = "update $af->{site__dbtbl_prefix}_CORE_friends set $attr = $value where uid = $uid";
 	my $sth;
 	eval{
 	    $sth = $af->getDB->prepare($query);
Index: affelio/lib/Affelio/SNS/Handshaker_s.pm
diff -u affelio/lib/Affelio/SNS/Handshaker_s.pm:1.40 affelio/lib/Affelio/SNS/Handshaker_s.pm:1.41
--- affelio/lib/Affelio/SNS/Handshaker_s.pm:1.40	Sun Jan 29 03:24:33 2006
+++ affelio/lib/Affelio/SNS/Handshaker_s.pm	Thu Feb 23 21:41:38 2006
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: Handshaker_s.pm,v 1.40 2006/01/28 18:24:33 slash5234 Exp $
+# $Id: Handshaker_s.pm,v 1.41 2006/02/23 12:41:38 slash5234 Exp $
 
 ########################################################################
 #package Affelio::SNS::Handshaker_s::Util;
@@ -109,7 +109,7 @@
         ###########################################
         # Send a message to MessageManager
         ###########################################
-	my $click_url = "$af->{site__web_root}/bin/recv_mail_ack.cgi?id=$sessionid";
+	my $click_url = "$af->{site__user_afid}/bin/recv_mail_ack.cgi?id=$sessionid";
 	my $mesg1 = "";
 	$mesg1 .= "<AF_M text='_HANDSHAKE_REQUEST_MAIL_MESG1' param='$peer_nickname'>";
 	$mesg1 .= "<AF_M text='_HANDSHAKE_REQUEST_MAIL_MESG2' param='$peer_nickname'>";
@@ -335,7 +335,7 @@
 	    $msg .= "<service about=\"" . $app->{app_URI} . "\">\n";
 	    $msg .= "<version>" . $app->{app_version} . "</version>\n";
 	    $msg .= "<name>" . $app->{app_name} . "</name>\n";
-	    $msg .= "<baseurl>" . $af->{site__web_root} 
+	    $msg .= "<baseurl>" . $af->{site__user_afid} 
 	    . "/apps/" . $apps->{install_name} .  "</baseurl>\n";
 	    $msg .= "</service>\n";
 	}
Index: affelio/lib/Affelio/SNS/Handshaker_tmpDB.pm
diff -u affelio/lib/Affelio/SNS/Handshaker_tmpDB.pm:1.4 affelio/lib/Affelio/SNS/Handshaker_tmpDB.pm:1.5
--- affelio/lib/Affelio/SNS/Handshaker_tmpDB.pm:1.4	Thu Oct 27 20:15:02 2005
+++ affelio/lib/Affelio/SNS/Handshaker_tmpDB.pm	Thu Feb 23 21:41:38 2006
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: Handshaker_tmpDB.pm,v 1.4 2005/10/27 11:15:02 slash5234 Exp $
+# $Id: Handshaker_tmpDB.pm,v 1.5 2006/02/23 12:41:38 slash5234 Exp $
 
 use strict;
 use lib("../../../extlib/");
@@ -89,10 +89,11 @@
 	my $DH_key_str = shift;      #arg(5) DH key (string)
 	my $dbname = shift;          #arg(6) DBname (string)
 
-	Affelio::misc::Debug::debug_print("add: $af_id $nickname $timestamp $DH_key_str $dbname");
-	
 	my $af = $self->{af};
+	$dbname =~ s/AFuser/$af->{site__dbtbl_prefix}/;
 
+	Affelio::misc::Debug::debug_print("add: $af_id $nickname $timestamp $DH_key_str $dbname");
+	
 	my $str = "insert into $dbname (sessionid, timestamp, af_id, nickname, DH_key_str) values ('$sessionid', '$timestamp', '$af_id', '$nickname', '$DH_key_str')";
 	my $sth = $af->getDB->prepare($str);
 	$sth->execute() or die $af->getDB->errstr;
@@ -110,6 +111,7 @@
 	my $dbname = shift;
 
 	my $af = $self->{af};
+	$dbname =~ s/AFuser/$af->{site__dbtbl_prefix}/;
 
 	Affelio::misc::Debug::debug_print("removedb: $sessionid");
 


Affelio-cvs メーリングリストの案内
Back to archive index