Tadashi Okoshi
slash****@users*****
2006年 2月 23日 (木) 21:41:38 JST
Index: affelio/lib/Affelio/Managing/AccessLogManager.pm
diff -u affelio/lib/Affelio/Managing/AccessLogManager.pm:1.11 affelio/lib/Affelio/Managing/AccessLogManager.pm:1.12
--- affelio/lib/Affelio/Managing/AccessLogManager.pm:1.11 Mon Dec 19 16:17:15 2005
+++ affelio/lib/Affelio/Managing/AccessLogManager.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: AccessLogManager.pm,v 1.11 2005/12/19 07:17:15 slash5234 Exp $
+# $Id: AccessLogManager.pm,v 1.12 2006/02/23 12:41:38 slash5234 Exp $
package Affelio::Managing::AccessLogManager;
{
@@ -67,7 +67,7 @@
################################
#Check the table
################################
- my $create_tbl_cmd = "CREATE TABLE AFuser_CORE_accesslog(id INTEGER PRIMARY KEY, id2 INTEGER, timestamp BIGINT, nickname TEXT, afid TEXT, type TEXT)";
+ my $create_tbl_cmd = "CREATE TABLE $af->{site__dbtbl_prefix}_CORE_accesslog(id INTEGER PRIMARY KEY, id2 INTEGER, timestamp BIGINT, nickname TEXT, afid TEXT, type TEXT)";
eval{
$af->getDB()->do($create_tbl_cmd);
};
@@ -81,7 +81,7 @@
################################
my $query1; my $sth1; $@="";
my @row1=();
- $query1 = "SELECT * FROM AFuser_CORE_accesslog WHERE timestamp >= $startoftheday AND afid = '$afid'";
+ $query1 = "SELECT * FROM $af->{site__dbtbl_prefix}_CORE_accesslog WHERE timestamp >= $startoftheday AND afid = '$afid'";
debug_print("AccessLog:save: q=[$query1]");
eval{
$sth1 = $af->getDB()->prepare($query1);
@@ -98,7 +98,7 @@
##############################
#Get existing max ID
- my $query2 = 'SELECT max(id) FROM AFuser_CORE_accesslog';
+ my $query2 = "SELECT max(id) FROM $af->{site__dbtbl_prefix}_CORE_accesslog";
my $sth2;
eval{
$sth2 = $af->getDB()->prepare($query2);
@@ -123,7 +123,7 @@
#Get existing max ID2
my $newid2=0; my $maxid2=0;
if($afid =~ /http/){
- $query2 = 'SELECT max(id2) FROM AFuser_CORE_accesslog';
+ $query2 = "SELECT max(id2) FROM $af->{site__dbtbl_prefix}_CORE_accesslog";
eval{
$sth2 = $af->getDB()->prepare($query2);
$sth2->execute;
@@ -147,7 +147,7 @@
#Add this access
################################
my $query3; my $sth3;
- $query3 = "insert into AFuser_CORE_accesslog(id, id2, timestamp, nickname, afid, type) values ($newid, $newid2, $cur_time, '$nickname', '$afid', '$type')";
+ $query3 = "insert into $af->{site__dbtbl_prefix}_CORE_accesslog(id, id2, timestamp, nickname, afid, type) values ($newid, $newid2, $cur_time, '$nickname', '$afid', '$type')";
eval{
$sth3 = $af->getDB()->prepare($query3);
$sth3->execute();
@@ -199,7 +199,7 @@
################################
#Check the table
################################
- my $create_tbl_cmd = "CREATE TABLE AFuser_CORE_accesslog(id INTEGER PRIMARY KEY, id2 INTEGER, timestamp INTEGER, nickname TEXT, afid TEXT, type TEXT)";
+ my $create_tbl_cmd = "CREATE TABLE $af->{site__dbtbl_prefix}_CORE_accesslog(id INTEGER PRIMARY KEY, id2 INTEGER, timestamp INTEGER, nickname TEXT, afid TEXT, type TEXT)";
eval{
$af->getDB()->do($create_tbl_cmd);
};
@@ -218,7 +218,7 @@
##############################
#retrieve all friend records from DB
- my $query = "SELECT * FROM AFuser_CORE_accesslog WHERE timestamp > $from AND timestamp < $to " . $TYPE . " order by id desc";
+ my $query = "SELECT * FROM $af->{site__dbtbl_prefix}_CORE_accesslog WHERE timestamp > $from AND timestamp < $to " . $TYPE . " order by id desc";
my $sth;
eval{
$sth = $af->getDB()->prepare($query);
Index: affelio/lib/Affelio/Managing/ApplicationManager.pm
diff -u affelio/lib/Affelio/Managing/ApplicationManager.pm:1.14 affelio/lib/Affelio/Managing/ApplicationManager.pm:1.15
--- affelio/lib/Affelio/Managing/ApplicationManager.pm:1.14 Mon Dec 26 19:15:39 2005
+++ affelio/lib/Affelio/Managing/ApplicationManager.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: ApplicationManager.pm,v 1.14 2005/12/26 10:15:39 slash5234 Exp $
+# $Id: ApplicationManager.pm,v 1.15 2006/02/23 12:41:38 slash5234 Exp $
package Affelio::Managing::ApplicationManager;
{
@@ -28,6 +28,7 @@
use Affelio::misc::Encoding qw(db_encode db_decode);
use Affelio::misc::Debug qw(debug_print);
use Affelio::exception::DBException;
+ use Affelio::exception::InvalidInputException;
#######################################################################
#Constructor
@@ -64,7 +65,7 @@
#############################
#DB access
#############################
- my $query = "update AFuser_CORE_apps set install_title = '$title' WHERE appid = $appid";
+ my $query = "update $af->{site__dbtbl_prefix}_CORE_apps set install_title = '$title' WHERE appid = $appid";
my $sth;
eval{
@@ -92,12 +93,13 @@
sub uninstall_app{
my $self = shift;
my $af = $self->{af};
- my $appid = shift;
+ my $app_id = shift;
+ my $install_name = shift;
#############################
#DB access
#############################
- my $query = "delete from AFuser_CORE_apps where appid = $appid";
+ my $query = "delete from $af->{site__dbtbl_prefix}_CORE_apps where appid = $app_id";
my $sth;
eval{
$sth = $af->getDB->prepare($query);
@@ -109,6 +111,17 @@
debug_print("ApplicationManager::uninstall_app: DB access done.");
#############################
+ #case: AFE2
+ # .htaccess operation
+ #############################
+ debug_print("ApplicationManager::uninstall_app to AFE2? [$self->{site__farm_mode}]");
+ if($af->{site__farm_mode} eq "AFE2"){
+ debug_print("ApplicationManager::uninstall_app to AFE2...");
+ $af->{farm_con}->uninstall_app(Username => $af->{site__username},
+ InstallName => $install_name);
+ }
+
+ #############################
#loadl_application
#############################
$af->getAM->load_applications();
@@ -123,6 +136,7 @@
sub install_app{
my $self = shift;
my $af = $self->{af};
+ my $app_dir = shift;
my $install_name = shift;
my $install_title = shift;
@@ -132,11 +146,10 @@
#Read .cfg file
#############################
my $cfg = Config::Tiny->new();
- $cfg = Config::Tiny->read("$af->{top_dir}/apps/$install_name/AF_app.cfg");
+ $cfg = Config::Tiny->read("$af->{top_dir}/apps/$app_dir/AF_app.cfg");
if(!$cfg){
- throw Affelio::exception::("Could not open /apps/$install_name/AF_app.cfg");
+ throw Affelio::exception::("Could not open /apps/$app_dir/AF_app.cfg");
}
-
debug_print("ApplicationManager::install_app opened config file");
#############################
@@ -157,9 +170,28 @@
debug_print("ApplicationManager::install_app data prep done.");
#############################
+ #DB access: check the same install_name
+ #############################
+ my $query0 = "select * from $af->{site__dbtbl_prefix}_CORE_apps where install_name = '$install_name'";
+ my $sth0;
+ eval{
+ $sth0 = $af->getDB->prepare($query0);
+ $sth0->execute();
+ };
+ if($@){
+ throw Affelio::exception::DBException($af->getDB->errstr);
+ }
+ my @array0= $sth0->fetchrow_array;
+ if(@array0){
+ throw Affelio::exception::InvalidInputException("Duplicated name");
+ }
+ debug_print("ApplicationManager::install_app DB check done.");
+
+
+ #############################
#DB access
#############################
- my $query = "insert into AFuser_CORE_apps(install_name, install_title, app_URI, app_name, app_version, app_desc, app_author, guest_index, owner_index, action_types, action_types_desc) values (?,?,?,?,?,?,?,?,?,?,?)";
+ my $query = "insert into $af->{site__dbtbl_prefix}_CORE_apps(install_name, install_title, app_URI, app_name, app_version, app_desc, app_author, guest_index, owner_index, action_types, action_types_desc) values (?,?,?,?,?,?,?,?,?,?,?)";
my $sth;
eval{
@@ -182,6 +214,18 @@
$af->getAM->load_applications();
#############################
+ #case: AFE2
+ # .htaccess operation
+ #############################
+ debug_print("ApplicationManager::install_app to AFE2? [$self->{site__farm_mode}]");
+ if($af->{site__farm_mode} eq "AFE2"){
+ debug_print("ApplicationManager::install_app to AFE2...");
+ $af->{farm_con}->install_app(Username => $af->{site__username},
+ AppDir => $app_dir,
+ InstallName => $install_name);
+ }
+
+ #############################
#prep userdata/ directory
#############################
$af->getAM->prepare_app_userdata_dir($install_name);
@@ -249,7 +293,7 @@
##############################
#Access apps DB
##############################
- my $query = "select appid, install_name, install_title, app_URI, app_name, app_version, app_desc, app_author, guest_index, owner_index, action_types, action_types_desc FROM AFuser_CORE_apps";
+ my $query = "select appid, install_name, install_title, app_URI, app_name, app_version, app_desc, app_author, guest_index, owner_index, action_types, action_types_desc FROM $af->{site__dbtbl_prefix}_CORE_apps";
my $sth;
eval{
$sth = $af->getDB->prepare($query);
@@ -329,7 +373,7 @@
debug_print("AppMan::get_permission type[$type] id[$id]");
- my $query = "select * FROM AFuser_" . $app_name
+ my $query = "select * FROM $af->{site__dbtbl_prefix}_" . $app_name
."_permission where type = '$type' and target_id = '$id'";
debug_print("AppMan::get_permission end: q=[$query]");
@@ -370,7 +414,7 @@
# f2 or PB
####################
- my $query = "select $action_type from AFuser_" . $app_name
+ my $query = "select $action_type from $af->{site__dbtbl_prefix}_" . $app_name
."_permission where type = 'f' and target_id = '$visitor_mode'";
debug_print("AppManager::get_summed_app_perm: q=[$query]");
@@ -398,7 +442,7 @@
#################
#(1) as a friend
- my $query = "select $action_type from AFuser_" . $app_name
+ my $query = "select $action_type from $af->{site__dbtbl_prefix}_" . $app_name
."_permission where type = 'f' and target_id = '$visitor_mode'";
my $sth = $af->getDB()->prepare($query) or
throw Affelio::exception::DBException("cannot insert");
@@ -426,7 +470,7 @@
while(@g_data = $SQL_result->fetchrow_array) {
my $gid = $g_data[0];
- my $query = "select $action_type from AFuser_" . $app_name
+ my $query = "select $action_type from $af->{site__dbtbl_prefix}_" . $app_name
."_permission where type = 'g' and target_id = '$gid'";
my $sth = $af->getDB()->prepare($query) or
throw Affelio::exception::DBException("cannot insert");
@@ -457,7 +501,7 @@
##############################
#retrieve all permission records from DB
- my $query = 'SELECT * FROM AFuser_' . $app_name . '_permission';
+ my $query = "SELECT * FROM $af->{site__dbtbl_prefix}_" . $app_name . '_permission';
my $sth;
eval{
$sth = $af->getDB()->prepare($query);
@@ -480,7 +524,7 @@
my $caller = shift; #application install name
#Does my application's permission table already exist?
- my $my_table_name = "AFuser_" . $caller . "_permission";
+ my $my_table_name = "$af->{site__dbtbl_prefix}_" . $caller . "_permission";
debug_print("AppManager::check_table: table = [".$my_table_name."]");
my $query = "SELECT * FROM " . $my_table_name;
@@ -568,7 +612,7 @@
############################
#check permission existence
############################
- my $query = 'SELECT count(*) FROM AFuser_'
+ my $query = "SELECT count(*) FROM $af->{site__dbtbl_prefix}_"
. $app_name . '_permission where pid =' . $pid;
my $sth;
eval{
@@ -587,7 +631,7 @@
if($retval == 0){
debug_print("AppManager::update_permission record does not exist");
debug_print("AppManager::update_permission We will make it.");
- $query = "insert into AFuser_" . $app_name . "_permission(";
+ $query = "insert into $af->{site__dbtbl_prefix}_" . $app_name . "_permission(";
my $total_col="pid, type, target_id,";
my $total_val="$pid, 'g', $gid,";
while (my ($action_type, $value) = each(%{$hash_ref}) ) {
@@ -598,7 +642,7 @@
chop($total_val);
$query = $query . $total_col . ") values (" . $total_val . ")";
}else{
- $query = "update AFuser_" . $app_name . "_permission set ";
+ $query = "update $af->{site__dbtbl_prefix}_" . $app_name . "_permission set ";
while (my ($action_type, $value) = each(%{$hash_ref}) ) {
$query .= "$action_type=$value,";
}
Index: affelio/lib/Affelio/Managing/GroupManager.pm
diff -u affelio/lib/Affelio/Managing/GroupManager.pm:1.8 affelio/lib/Affelio/Managing/GroupManager.pm:1.9
--- affelio/lib/Affelio/Managing/GroupManager.pm:1.8 Tue Nov 8 14:16:29 2005
+++ affelio/lib/Affelio/Managing/GroupManager.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: GroupManager.pm,v 1.8 2005/11/08 05:16:29 slash5234 Exp $
+# $Id: GroupManager.pm,v 1.9 2006/02/23 12:41:38 slash5234 Exp $
package Affelio::Managing::GroupManager;
{
@@ -59,7 +59,7 @@
##############################
#Get existing max ID
- my $query = 'SELECT max(gid) FROM AFuser_CORE_group';
+ my $query = "SELECT max(gid) FROM $af->{site__dbtbl_prefix}_CORE_group";
my $sth;
eval{
$sth = $af->getDB->prepare($query);
@@ -80,7 +80,7 @@
##############################
#Insert a new record
- $query = 'insert into AFuser_CORE_group(gid, group_name, members, option_pid) values (?,?,?,?)';
+ $query = "insert into $af->{site__dbtbl_prefix}_CORE_group(gid, group_name, members, option_pid) values (?,?,?,?)";
eval{
$sth = $af->getDB->prepare($query);
$sth->execute($maxid+1, $group_name, ",", -1);
@@ -103,7 +103,7 @@
debug_print("remove_group: g[$gid]");
my $af = $self->{af};
- my $query1 = 'SELECT option_pid FROM AFuser_CORE_group WHERE gid = ?';
+ my $query1 = "SELECT option_pid FROM $af->{site__dbtbl_prefix}_CORE_group WHERE gid = ?";
my $sth1;
eval{
$sth1 = $af->getDB->prepare($query1);
@@ -116,7 +116,7 @@
my @row1 = $sth1->fetchrow_array;
my $perm_id = $row1[0];
- my $query2 = 'DELETE FROM AFuser_CORE_group WHERE gid = ?';
+ my $query2 = "DELETE FROM $af->{site__dbtbl_prefix}_CORE_group WHERE gid = ?";
my $sth2;
eval{
$sth2 = $af->getDB->prepare($query2);
@@ -145,7 +145,7 @@
##############################
#Update DB
- my $query = "update AFuser_CORE_group set group_name = '$new_name' where gid = $gid";
+ my $query = "update $af->{site__dbtbl_prefix}_CORE_group set group_name = '$new_name' where gid = $gid";
my $sth;
eval{
$sth = $af->getDB->prepare($query);
@@ -169,7 +169,7 @@
debug_print("get_member: g[$gid]");
my $af = $self->{af};
- my $query = 'SELECT members FROM AFuser_CORE_group WHERE gid = ?';
+ my $query = "SELECT members FROM $af->{site__dbtbl_prefix}_CORE_group WHERE gid = ?";
my $sth;
eval{
$sth = $af->getDB->prepare($query);
@@ -204,7 +204,7 @@
##############################
#retrieve a friend record from DB
- my $query = 'SELECT * FROM AFuser_CORE_group WHERE gid = ?';
+ my $query = "SELECT * FROM $af->{site__dbtbl_prefix}_CORE_group WHERE gid = ?";
my $sth;
eval{
$sth = $af->getDB->prepare($query);
@@ -236,7 +236,7 @@
##############################
#Update DB
- $query = "update AFuser_CORE_group set members = '$new_mem' where gid = $gid";
+ $query = "update $af->{site__dbtbl_prefix}_CORE_group set members = '$new_mem' where gid = $gid";
eval{
$sth = $af->getDB->prepare($query);
$sth->execute;
@@ -259,7 +259,7 @@
my $af=$self->{af};
db_value_replace($af->getDB,
- "AFuser_CORE_group",
+ "$af->{site__dbtbl_prefix}_CORE_group",
"gid",
"members",
",$uid," ,
@@ -279,7 +279,7 @@
debug_print("remove_member: g[$gid] u[$uid]");
my $af = $self->{af};
- my $query = 'SELECT members FROM AFuser_CORE_group WHERE gid = ?';
+ my $query = "SELECT members FROM $af->{site__dbtbl_prefix}_CORE_group WHERE gid = ?";
my $sth;
eval{
$sth = $af->getDB->prepare($query);
@@ -299,7 +299,7 @@
$row[0] =~ s/,$uid,/,/;
debug_print("remove_member: Member($gid) = ($row[0]) (after)");
- my $query2 = "update AFuser_CORE_group set members = '$row[0]' where gid = $gid";
+ my $query2 = "update $af->{site__dbtbl_prefix}_CORE_group set members = '$row[0]' where gid = $gid";
my $sth2;
eval{
$sth2= $af->getDB->prepare($query2);
@@ -326,7 +326,7 @@
my $af = $self->{af};
my $query =
- "SELECT * FROM AFuser_CORE_group WHERE members like '%,$uid,%'";
+ "SELECT * FROM $af->{site__dbtbl_prefix}_CORE_group WHERE members like '%,$uid,%'";
debug_print("get_groups_by_uid: q=[$query]");
##############################
@@ -354,7 +354,7 @@
debug_print("get_unsubscribing_groups_by_uid: u[$uid]");
my $af = $self->{af};
- my $query = "SELECT * FROM AFuser_CORE_group WHERE members NOT like "
+ my $query = "SELECT * FROM $af->{site__dbtbl_prefix}_CORE_group WHERE members NOT like "
."'%,$uid,%'";
debug_print("get_unsubscribing_groups_by_uid: q=[$query]");
@@ -385,7 +385,7 @@
##############################
#retrieve all friend records from DB
- my $query = 'SELECT * FROM AFuser_CORE_group';
+ my $query = "SELECT * FROM $af->{site__dbtbl_prefix}_CORE_group";
my $sth;
eval{
$sth= $af->getDB->prepare($query);
@@ -431,7 +431,7 @@
##############################
#Update DB
- my $query = "update AFuser_CORE_group set members = '$uids_str' where gid = $gid";
+ my $query = "update $af->{site__dbtbl_prefix}_CORE_group set members = '$uids_str' where gid = $gid";
my $sth;
eval{
$sth= $af->getDB->prepare($query);
@@ -457,7 +457,7 @@
##############################
#Update DB
- my $query = "update AFuser_CORE_group set option_pid = $pid where gid = $gid";
+ my $query = "update $af->{site__dbtbl_prefix}_CORE_group set option_pid = $pid where gid = $gid";
my $sth;
eval{
$sth= $af->getDB->prepare($query);
Index: affelio/lib/Affelio/Managing/MessageManager.pm
diff -u affelio/lib/Affelio/Managing/MessageManager.pm:1.12 affelio/lib/Affelio/Managing/MessageManager.pm:1.13
--- affelio/lib/Affelio/Managing/MessageManager.pm:1.12 Fri Nov 18 20:14:04 2005
+++ affelio/lib/Affelio/Managing/MessageManager.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: MessageManager.pm,v 1.12 2005/11/18 11:14:04 slash5234 Exp $
+# $Id: MessageManager.pm,v 1.13 2006/02/23 12:41:38 slash5234 Exp $
package Affelio::Managing::MessageManager;
{
@@ -62,7 +62,7 @@
my $sth;
eval{
- $sth = $af->getDB->prepare(q{SELECT * FROM AFuser_CORE_message where readflag=0});
+ $sth = $af->getDB->prepare("SELECT * FROM $af->{site__dbtbl_prefix}_CORE_message where readflag=0");
$sth->execute;
};
if($@){
@@ -89,7 +89,7 @@
my $af = $self->{af};
- my $query = "update AFuser_CORE_message set readflag = 1 where mid = $mid";
+ my $query = "update $af->{site__dbtbl_prefix}_CORE_message set readflag = 1 where mid = $mid";
my $sth;
eval{
$sth = $af->getDB->prepare($query);
@@ -119,7 +119,7 @@
#retrieve all friend records from DB
my $sth;
eval{
- $sth = $af->getDB->prepare(q{SELECT * FROM AFuser_CORE_message order by timestamp desc});
+ $sth = $af->getDB->prepare("SELECT * FROM $af->{site__dbtbl_prefix}_CORE_message order by timestamp desc");
$sth->execute;
};
if($@){
@@ -146,7 +146,7 @@
#retrieve all friend records from DB
my $sth;
eval{
- $sth = $af->getDB->prepare("SELECT * FROM AFuser_CORE_message where mid = $mid");
+ $sth = $af->getDB->prepare("SELECT * FROM $af->{site__dbtbl_prefix}_CORE_message where mid = $mid");
$sth->execute;
};
if($@){
@@ -186,7 +186,7 @@
#Get existing max ID
my $sth;
eval{
- $sth = $af->getDB->prepare(q{SELECT max(mid) FROM AFuser_CORE_message});
+ $sth = $af->getDB->prepare("SELECT max(mid) FROM $af->{site__dbtbl_prefix}_CORE_message");
$sth->execute;
};
if($@){
@@ -212,7 +212,7 @@
##############################
#Insert a new record
- my $str10 = "insert into AFuser_CORE_message(msgbody, mid, timestamp, msgtitle, msgtype, msgfrom, readflag) values ('$body', $newid, '$cur_time', '$title', '$type', '$from', 0)";
+ my $str10 = "insert into $af->{site__dbtbl_prefix}_CORE_message(msgbody, mid, timestamp, msgtitle, msgtype, msgfrom, readflag) values ('$body', $newid, '$cur_time', '$title', '$type', '$from', 0)";
eval{
$sth = $af->getDB->prepare($str10);
$sth->execute;
@@ -229,7 +229,7 @@
##############################
#Email notification if needed
if($af->{userpref__mesging__emailflg} eq "yes"){
- my $abs_URL = $af->{site__web_root} . "/admin.cgi?mode=messages&action=show&mid=$newid";
+ my $abs_URL = $af->{site__user_afid} . "/admin.cgi?mode=messages&action=show&mid=$newid";
Affelio::NetLib::Email::send_email($af->{cmd__sendmail}, "$af->{user__email1}", "Your Affelio", $af->{user__email1}, "Message from $from_onlyname", "Click this URL.\n$abs_URL");
Affelio::misc::Debug::debug_print("MM::post_message: Email sent!");
Index: affelio/lib/Affelio/Managing/MyNewsManager.pm
diff -u affelio/lib/Affelio/Managing/MyNewsManager.pm:1.5 affelio/lib/Affelio/Managing/MyNewsManager.pm:1.6
--- affelio/lib/Affelio/Managing/MyNewsManager.pm:1.5 Mon Dec 19 17:38:53 2005
+++ affelio/lib/Affelio/Managing/MyNewsManager.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: MyNewsManager.pm,v 1.5 2005/12/19 08:38:53 slash5234 Exp $
+# $Id: MyNewsManager.pm,v 1.6 2006/02/23 12:41:38 slash5234 Exp $
package Affelio::Managing::MyNewsManager;
{
@@ -68,7 +68,7 @@
$app_list ="app_install_name='" . $app_list . "'";
debug_print("MyNews::retrieve: apps [$app_list]");
- my $query= "SELECT nid, datetime, app_install_name, title, description, creator, URL FROM AFuser_CORE_my_news WHERE datetime > $laterthan and ($app_list) order by datetime desc";
+ my $query= "SELECT nid, datetime, app_install_name, title, description, creator, URL FROM $af->{site__dbtbl_prefix}_CORE_my_news WHERE datetime > $laterthan and ($app_list) order by datetime desc";
debug_print("MyNews::retrieve: query [$query]");
##############################
@@ -111,7 +111,7 @@
##############################
#Insert a new record
- my $sth = "insert into AFuser_CORE_my_news(datetime, app_install_name, title, description, creator, URL) values ($datetime, '$app_install_name', '$title', '$description', '$creator', '$URL')";
+ my $sth = "insert into $af->{site__dbtbl_prefix}_CORE_my_news(datetime, app_install_name, title, description, creator, URL) values ($datetime, '$app_install_name', '$title', '$description', '$creator', '$URL')";
$sth = $af->getDB->prepare($sth) or die $af->getDB->errstr;
$sth->execute or die $af->getDB->errstr;
Index: affelio/lib/Affelio/Managing/NewsAggregator.pm
diff -u affelio/lib/Affelio/Managing/NewsAggregator.pm:1.16 affelio/lib/Affelio/Managing/NewsAggregator.pm:1.17
--- affelio/lib/Affelio/Managing/NewsAggregator.pm:1.16 Thu Jan 19 16:18:09 2006
+++ affelio/lib/Affelio/Managing/NewsAggregator.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: NewsAggregator.pm,v 1.16 2006/01/19 07:18:09 slash5234 Exp $
+# $Id: NewsAggregator.pm,v 1.17 2006/02/23 12:41:38 slash5234 Exp $
package Affelio::Managing::NewsAggregator;
{
@@ -60,7 +60,7 @@
##############################
#Insert a new record
- my $sth = "insert into AFuser_CORE_nghr_news(datetime, af_id, nickname, app_install_name, title, description, creator, URL) values ('$arg{datetime}', '$arg{af_id}', '$arg{nickname}', '$arg{app}', '$arg{title}', '$arg{desc}', '$arg{creator}', '$arg{URL}')";
+ my $sth = "insert into $af->{site__dbtbl_prefix}_CORE_nghr_news(datetime, af_id, nickname, app_install_name, title, description, creator, URL) values ('$arg{datetime}', '$arg{af_id}', '$arg{nickname}', '$arg{app}', '$arg{title}', '$arg{desc}', '$arg{creator}', '$arg{URL}')";
eval{
$sth = $af->getDB->prepare($sth);
$sth->execute;
@@ -83,7 +83,7 @@
##############################
#retrieve all friend records from DB
- my $query = "SELECT datetime, af_id, nickname, app_install_name, title, description, creator, URL FROM AFuser_CORE_nghr_news order by datetime desc";
+ my $query = "SELECT datetime, af_id, nickname, app_install_name, title, description, creator, URL FROM $af->{site__dbtbl_prefix}_CORE_nghr_news order by datetime desc";
my $sth;
eval{
$sth = $af->getDB->prepare($query);
@@ -128,7 +128,7 @@
#########################################################
#generate X-WSSE message
- my $xwsse_mesg = Affelio::misc::WSSE::make_XWSSE($af->{site__web_root},
+ my $xwsse_mesg = Affelio::misc::WSSE::make_XWSSE($af->{site__user_afid},
$password);
debug_print("NewsAggregator::get_one: [$xwsse_mesg]");
Index: affelio/lib/Affelio/Managing/PermissionManager.pm
diff -u affelio/lib/Affelio/Managing/PermissionManager.pm:1.5 affelio/lib/Affelio/Managing/PermissionManager.pm:1.6
--- affelio/lib/Affelio/Managing/PermissionManager.pm:1.5 Thu Oct 27 20:15:01 2005
+++ affelio/lib/Affelio/Managing/PermissionManager.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: PermissionManager.pm,v 1.5 2005/10/27 11:15:01 slash5234 Exp $
+# $Id: PermissionManager.pm,v 1.6 2006/02/23 12:41:38 slash5234 Exp $
package Affelio::Managing::PermissionManager;
{
@@ -70,7 +70,7 @@
debug_print("add_permission (increased) size(flag)=$flag_size");
#Decide $newid
- my $query = 'SELECT max(pid) FROM AFuser_CORE_permission';
+ my $query = "SELECT max(pid) FROM $af->{site__dbtbl_prefix}_CORE_permission";
my $sth;
eval{
$sth= $af->getDB->prepare($query);
@@ -90,7 +90,7 @@
my $newid = $maxid + 1;
#generate an SQL query
- $query = "insert into AFuser_CORE_permission(pid, type, target_id";
+ $query = "insert into $af->{site__dbtbl_prefix}_CORE_permission(pid, type, target_id";
for(my $j=0; $j<=63; $j++){
$query .= ", attr$j";
}
@@ -154,7 +154,7 @@
}
#prepare SQL query
- my $query = "update AFuser_CORE_permission set ";
+ my $query = "update $af->{site__dbtbl_prefix}_CORE_permission set ";
for(my $k=0; $k<=63; $k++){
$query .= " attr$k = '" . $flag_array[$k] . "'," ;
}
@@ -186,7 +186,7 @@
debug_print("get_permission type[$type] id[$id]");
my $af = $self->{af};
- my $query = "SELECT * FROM AFuser_CORE_permission where type='$type' and target_id='$id'";
+ my $query = "SELECT * FROM $af->{site__dbtbl_prefix}_CORE_permission where type='$type' and target_id='$id'";
debug_print("get_permission end: q=[$query]");
my $sth;
@@ -213,7 +213,7 @@
debug_print("get_permission_by_pid pid[$pid]");
my $af = $self->{af};
- my $query = 'SELECT * FROM AFuser_CORE_permission WHERE pid = ?';
+ my $query = 'SELECT * FROM $af->{site__dbtbl_prefix}_CORE_permission WHERE pid = ?';
my $sth;
eval{
@@ -238,7 +238,7 @@
debug_print("remove_permission_by_pid pid[$pid]");
my $af = $self->{af};
- my $query = 'DELETE FROM AFuser_CORE_permission WHERE pid = ?';
+ my $query = "DELETE FROM $af->{site__dbtbl_prefix}_CORE_permission WHERE pid = ?";
my $sth;
eval{
$sth = $af->getDB->prepare($query);
@@ -264,7 +264,7 @@
##############################
#retrieve all permission records from DB
- my $query = 'SELECT * FROM AFuser_CORE_permission';
+ my $query = "SELECT * FROM $af->{site__dbtbl_prefix}_CORE_permission";
my $sth;
eval{
Index: affelio/lib/Affelio/Managing/ProfileManager.pm
diff -u affelio/lib/Affelio/Managing/ProfileManager.pm:1.5 affelio/lib/Affelio/Managing/ProfileManager.pm:1.6
--- affelio/lib/Affelio/Managing/ProfileManager.pm:1.5 Thu Oct 27 20:15:01 2005
+++ affelio/lib/Affelio/Managing/ProfileManager.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: ProfileManager.pm,v 1.5 2005/10/27 11:15:01 slash5234 Exp $
+# $Id: ProfileManager.pm,v 1.6 2006/02/23 12:41:38 slash5234 Exp $
package Affelio::Managing::ProfileManager;
{
@@ -87,41 +87,46 @@
my $attribute = shift;
my $value = shift;
- debug_print("ProfileManager::save_profile_value: ($attribute) = ($value)");
+ my $db = $af->getDB();
- my $query = "SELECT * FROM AFuser_CORE_prof where attribute = '$attribute'";
+ debug_print("ProfileManager::save_profile_value: ($attribute) = ($value)");
+ my $query = "SELECT * FROM $af->{site__dbtbl_prefix}_CORE_prof where attribute = '$attribute'";
my $sth1;
eval{
- $sth1 = $af->getDB->prepare($query);
+ $sth1 = $db->prepare($query);
$sth1->execute;
};
if($@){
- throw Affelio::exception::DBException($af->getDB->errstr);
+ throw Affelio::exception::DBException($db->errstr);
}
-
my @result= $sth1->fetchrow_array();
+ undef($sth1);
+
if(@result==()){
- my $query2 = 'insert into AFuser_CORE_prof(attribute, value) values (?,?)';
- my $sth2;
+
+ my $query2 = "insert into $af->{site__dbtbl_prefix}_CORE_prof(attribute, value) values (?,?)";
+ my $sth2="";
eval{
- $sth2 = $af->getDB->prepare($query2);
+ $sth2 = $db->prepare($query2);
$sth2->execute($attribute, $value);
};
if($@){
- throw Affelio::exception::DBException($af->getDB->errstr);
+ throw Affelio::exception::DBException($db->errstr);
}
+ undef($sth2);
}else{
- my $query3 = "update AFuser_CORE_prof set value = '$value' where attribute = '$attribute'";
+ my $query3 = "update $af->{site__dbtbl_prefix}_CORE_prof set value = '$value' where attribute = '$attribute'";
my $sth3;
eval{
- $sth3 = $af->getDB->prepare($query3);
+ $sth3 = $db->prepare($query3);
$sth3->execute;
};
if($@){
- throw Affelio::exception::DBException($af->getDB->errstr);
+ throw Affelio::exception::DBException($db->errstr);
}
+ undef($sth3);
}
}
@@ -164,7 +169,7 @@
my $af = $self->{af};
my $sth;
- my $query = 'SELECT * FROM AFuser_CORE_prof';
+ my $query = "SELECT * FROM $af->{site__dbtbl_prefix}_CORE_prof";
eval{
$sth = $af->getDB->prepare($query);
@@ -187,7 +192,7 @@
##############################
#retrieve all friend records from DB
- my $query = 'SELECT * FROM AFuser_CORE_prof_attr';
+ my $query = "SELECT * FROM $af->{site__dbtbl_prefix}_CORE_prof_attr";
my $sth;
eval{
Index: affelio/lib/Affelio/Managing/SessionManager.pm
diff -u affelio/lib/Affelio/Managing/SessionManager.pm:1.4 affelio/lib/Affelio/Managing/SessionManager.pm:1.5
--- affelio/lib/Affelio/Managing/SessionManager.pm:1.4 Sat Jan 28 17:47:21 2006
+++ affelio/lib/Affelio/Managing/SessionManager.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: SessionManager.pm,v 1.4 2006/01/28 08:47:21 slash5234 Exp $
+# $Id: SessionManager.pm,v 1.5 2006/02/23 12:41:38 slash5234 Exp $
package Affelio::Managing::SessionManager;
{
@@ -34,30 +34,11 @@
#######################################################################
sub new{
my $class = shift;
- my $af = shift;
debug_print("SessionManager::new: start.");
- my $cgi = $af->{cgi};
- my $given_sid = $cgi->cookie("affelio-$af->{user__nickname}");
- debug_print("SessionManager::new: sid from cookie: [" . $given_sid . "]");
- my $session="";
- if($given_sid){
- $session = new CGI::Session(undef,
- $given_sid,
- {Directory=> $af->{site__session_dir}});
- debug_print("SessionManager::new: sid after load: [" . $session->id . "]");
- }
- debug_print("SessionManager::new: $session");
- if($session){
- if( $given_sid ne $session->id ){
- debug_print("SessionManager::new: SID in user's cookie already expired.");
- debug_print("SessionManager::new: session deleted.");
- $session->delete();
- $session->flush();
- undef($session);
- }
- }
+ my $af="";
+ my $session="";
my $self = {af => $af,
ss => $session
@@ -69,6 +50,41 @@
return $self;
}
+ #######################################################################
+ #init
+ #######################################################################
+ sub init{
+ my $self = shift;
+ my $af = shift;
+
+
+ debug_print("SessionManager::init: start.");
+
+ $self->{af} = $af;
+ my $cgi = $af->{cgi};
+ my $given_sid = $cgi->cookie("affelio-$af->{user__nickname}");
+ debug_print("SessionManager::init: sid from cookie: [" . $given_sid . "]");
+ if($given_sid){
+ $self->{ss} = new CGI::Session(undef,
+ $given_sid,
+ {Directory=> $af->{site__session_dir}});
+ debug_print("SessionManager::init: sid after load: [" . $self->{ss}->id . "]");
+ }
+ debug_print("SessionManager::init: $self->{ss}");
+
+ if($self->{ss}){
+ if( $given_sid ne $self->{ss}->id ){
+ debug_print("SessionManager::init: SID in user's cookie already expired.");
+ debug_print("SessionManager::init: session deleted.");
+ $self->{ss}->delete();
+ $self->{ss}->flush();
+ undef($self->{ss});
+ }
+ }
+
+ debug_print("SessionManager::init: end.");
+ }
+
######################################################################
#get_userclass
######################################################################
@@ -110,13 +126,15 @@
undef,
{Directory=> $af->{site__session_dir}});
- debug_print("SessionManager::startup: created ["
- . $self->{ss}->id . "]");
-
#Set values into session
$self->{ss}->param("user_afid", $param{user_afid});
$self->{ss}->param("user_nickname", $param{user_nickname});
$self->{ss}->param("type", $param{type});
+
+ debug_print("SessionManager::startup: created [".$self->{ss}->id."]");
+ debug_print("SessionManager::startup: user_afid = $param{user_afid}");
+ debug_print("SessionManager::startup: user_nickname = $param{user_nickname}");
+ debug_print("SessionManager::startup: type = $param{type}");
}
######################################################################
@@ -129,7 +147,11 @@
my $cookie = $af->{cgi}->cookie(
-name => "affelio-$af->{user__nickname}",
-value => $self->{ss}->id(),
- -path => URL2path($af->{site__web_root}));
+ -path => URL2path($af->{site__user_afid}));
+
+ debug_print("SessionManager::issue_cookie: created [".$self->{ss}->id."]");
+ debug_print("SessionManager::startup: name = affelio-$af->{user__nickname}");
+ debug_print("SessionManager::startup: path = " . URL2path($af->{site__user_afid}));
return($cookie);
}