define('ROSTER_ADDONMB_PHPBBPREFIX','phpbb_');
define('ROSTER_ADDONMB_PHPBBFORUM_ID','1');
define('ROSTER_ADDONMB_PHPBBUSER_ID','2');
define('ROSTER_ADDONMB_PHPBBUSER_NAME','Ian');
define('ROSTER_ADDONMB_DATEFORMAT','G:i d/m/Y T');
/**
* Memberlog function
*
* @param string $name
* @param enum NEW,OLD $type
*/
function memberLog($name, $type)
{
$name = $this->escape($name);
$post_data['topic_type'] = POST_NORMAL;
$post_data['last_post'] = false;
$post_data['has_poll'] = false;
$post_data['edit_poll'] = false;
$post_data['first_post'] = true;
mt_srand( (double) microtime() * 1000000000);
$bbcode_uid = mt_rand();
$bbcode_uid = substr($bbcode_uid, 0, 10);
if($type =='OLD'){
$subtype = '[color=red:'.$bbcode_uid.']removed[/color:'.$bbcode_uid.']';
$stype = "REMOVED";
}else{
$subtype = '[color=green:'.$bbcode_uid.']added[/color:'.$bbcode_uid.']' ;
$stype = "ADDED";
}
$current_time = time();
$username = ROSTER_ADDONMB_PHPBBUSER_NAME;
$subject = $name.' - '.$stype;
$message = $this->escape('[b:'.$bbcode_uid.']'.$name.'[/b:'.$bbcode_uid.'] has been '.$subtype.' '.date(ROSTER_ADDONMB_DATEFORMAT,$current_time));
$sql = "INSERT INTO ".ROSTER_ADDONMB_PHPBBPREFIX."topics (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('$subject', '".ROSTER_ADDONMB_PHPBBUSER_ID."', $current_time, ".ROSTER_ADDONMB_PHPBBFORUM_ID.", 0, 0, 0)";
$result = $this->query($sql);
$this->free_result($result);
$topic_id = mysql_insert_id($this->db);
$sql = "INSERT INTO ".ROSTER_ADDONMB_PHPBBPREFIX."posts (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig) VALUES ($topic_id, ".ROSTER_ADDONMB_PHPBBFORUM_ID.", ".ROSTER_ADDONMB_PHPBBUSER_ID.", '$username', $current_time, 'localhost', 1, 1, 1, 1)";
$result = $this->query($sql);
$this->free_result($result);
$post_id = mysql_insert_id($this->db);
$sql = "INSERT INTO ".ROSTER_ADDONMB_PHPBBPREFIX."posts_text (post_id, post_subject, bbcode_uid, post_text) VALUES ($post_id, '$subject', '$bbcode_uid', '$message')";
$result = $this->query($sql);
$this->free_result($result);
$sql = "UPDATE ".ROSTER_ADDONMB_PHPBBPREFIX."topics SET topic_first_post_id = '$post_id', topic_last_post_id = '$post_id' WHERE topic_id = '$topic_id'";
$result = $this->query($sql);
$this->free_result($result);
$this->reset_values();
$this->add_value('name', $name );
$this->add_value('type', $type );
$this->add_value('date', time() );
$querystr = "INSERT INTO `".ROSTER_MEMBERLOGTABLE."` SET ".$this->assignstr;
$result = $this->query($querystr);
if( !$result )
{
$this->setError('Member Log ['.$name.'] could not be inserted',$this->error());
} else {
$this->setMessage("<li>Member Log [".$name."] inserted</li>\n");
}
}
/**
* Update Memberlog function
*
*/
function updateMemberlog( $data , $type )
{
$name = $data['name'];
$post_data['topic_type'] = POST_NORMAL;
$post_data['last_post'] = false;
$post_data['has_poll'] = false;
$post_data['edit_poll'] = false;
$post_data['first_post'] = true;
mt_srand( (double) microtime() * 1000000000);
$bbcode_uid = mt_rand();
$bbcode_uid = substr($bbcode_uid, 0, 10);
if($type =='OLD'){
$subtype = '[color=red:'.$bbcode_uid.']removed[/color:'.$bbcode_uid.']';
$stype = "REMOVED";
}else{
$subtype = '[color=green:'.$bbcode_uid.']added[/color:'.$bbcode_uid.']' ;
$stype = "ADDED";
}
$current_time = time();
$username = ROSTER_ADDONMB_PHPBBUSER_NAME;
$subject = $name.' - '.$stype;
$message = $this->escape('[b:'.$bbcode_uid.']'.$name.'[/b:'.$bbcode_uid.'] has been '.$subtype.' '.date(ROSTER_ADDONMB_DATEFORMAT,$current_time));
$sql = "INSERT INTO ".ROSTER_ADDONMB_PHPBBPREFIX."topics (topic_title, topic_poster, topic_time, forum_id, topic_status, topic_type, topic_vote) VALUES ('$subject', '".ROSTER_ADDONMB_PHPBBUSER_ID."', $current_time, ".ROSTER_ADDONMB_PHPBBFORUM_ID.", 0, 0, 0)";
$result = $this->query($sql);
$this->free_result($result);
$topic_id = mysql_insert_id($this->db);
$sql = "INSERT INTO ".ROSTER_ADDONMB_PHPBBPREFIX."posts (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig) VALUES ($topic_id, ".ROSTER_ADDONMB_PHPBBFORUM_ID.", ".ROSTER_ADDONMB_PHPBBUSER_ID.", '$username', $current_time, 'localhost', 1, 1, 1, 1)";
$result = $this->query($sql);
$this->free_result($result);
$post_id = mysql_insert_id($this->db);
$sql = "INSERT INTO ".ROSTER_ADDONMB_PHPBBPREFIX."posts_text (post_id, post_subject, bbcode_uid, post_text) VALUES ($post_id, '$subject', '$bbcode_uid', '$message')";
$result = $this->query($sql);
$this->free_result($result);
$sql = "UPDATE ".ROSTER_ADDONMB_PHPBBPREFIX."topics SET topic_first_post_id = '$post_id', topic_last_post_id = '$post_id' WHERE topic_id = '$topic_id'";
$result = $this->query($sql);
$this->free_result($result);
$this->reset_values();
$this->add_value('member_id', $data['member_id'] );
$this->add_value('name', $data['name'] );
$this->add_value('guild_id', $data['guild_id'] );
$this->add_value('class', $data['class'] );
$this->add_value('level', $data['level'] );
$this->add_value('note', $data['note'] );
$this->add_value('guild_rank', $data['guild_rank'] );
$this->add_value('guild_title', $data['guild_title'] );
$this->add_value('officer_note', $data['officer_note'] );
$this->add_value('update_time', $data['update_time'] );
$this->add_value('type', $type );
$querystr = "INSERT INTO `".ROSTER_MEMBERLOGTABLE."` SET ".$this->assignstr;
$result = $this->query($querystr);
if( !$result )
{
$this->setError('Member Log ['.$data['name'].'] could not be inserted',$this->error());
}
}
Users browsing this forum: No registered users and 0 guests