Buddy System v1.12
Original Author: CrappoMan (v4.01)
Mod Author: Carsten Puka  2004-2005
Email: webmaster@carstenpukass.de
Mod Modify by: PahaW  2007
Email: paha@khspu.ru
-------------------------------------------

INSTALLATION
------------
1. Upload the complete ZIP-File in the correct folders of your Webspace

2. Open profile.php File in an editor of your choice
and follow the steps :

==================================================
a) Search for :
--------------------------------------------------

include LOCALE.LOCALESET."user_fields.php";

Add directly under the following :
--------------------------------------------------

if (file_exists(INFUSIONS."buddy_system_panel/locale/".$settings['locale'].".php")) {
include INFUSIONS."buddy_system_panel/locale/".$settings['locale'].".php";
} else {
include INFUSIONS."buddy_system_panel/locale/English.php";
}
if(iMEMBER && isset($lookup) && isset($addbuddy)){
dbquery("INSERT INTO ".$db_prefix."buddy VALUES('".$userdata['user_id']."','".$lookup."')");
}

b) Search for :
--------------------------------------------------
if ($data['user_groups']) {

Add directly before the following :
--------------------------------------------------
//PahaW - buddy - start

if (dbrows(dbquery("SELECT * FROM ".$db_prefix."buddy WHERE buddy_user_id='".$userdata['user_id']."' AND buddy_buddy_id='".$lookup."'"))==0){
   echo "<a href='".BASEDIR."profile.php?lookup=".$data['user_id']."&addbuddy'><center>".$locale['BUD106']."</center></a>";
} else {
   echo "<center><b><font color='green'>".$locale['BUD109']."</font></center><br>";
}


tablebreak();
opentable($locale['BUD100']);
if (iMEMBER) {
   $result=dbquery("SELECT user_id, user_name, user_aim, user_msn, user_yahoo, user_icq, user_web, if((UNIX_TIMESTAMP(NOW()+0)-user_lastvisit)<60,'".$locale['BUD101']."','".$locale['BUD102']."') AS buddy_status "." FROM ".$db_prefix."buddy INNER JOIN ".$db_prefix."users ON buddy_buddy_id=user_id "." WHERE buddy_user_id='".$lookup."' ORDER BY buddy_status DESC, user_name ASC");
   if (dbrows($result)!=0) {
      echo "<table align='center' cellpadding='0' cellspacing='1' width='400' class='tbl-border'>";
      echo "<tr align='center'><td class='tbl2'><b>".$locale['u001']."</b></td><td class='tbl2'><b>".$locale['u045']."</b></td><td class='tbl2'><b>".$locale['u061']."</b></td></tr>";
      while($data=dbarray($result)) {
           echo "<tr>
                  <td align='left' class='tbl1'><b>".$data['user_name']."</b></td>
                  <td class='tbl1' align='center'>".$data['buddy_status']."</td>
                  <td class='tbl1'>\n";
		if ($data['user_aim'] && file_exists(THEME."forum/aim.gif")) {
			echo "<a href='aim:goim?screenname=".str_replace(" ", "+", $data['user_aim'])."' target='_blank'><img src='".THEME."forum/aim.gif' alt='".$data['user_aim']."' style='border:0px;'></a> ";
		}
		if ($data['user_icq']) {
			echo "<a href='http://web.icq.com/wwp?Uin=".$data['user_icq']."' target='_blank'><img src='".THEME."forum/icq.gif' alt='".$data['user_icq']."' style='border:0px;'></a> ";
		}
		if ($data['user_msn']) {
			echo "<a href='mailto:$data[user_msn]'><img src='".THEME."forum/msn.gif' alt='".$data['user_msn']."' style='border:0px;'></a> ";
		}
		if ($data['user_yahoo']) {
			echo "<a href='http://uk.profiles.yahoo.com/$data[user_yahoo]' target='_blank'><img src='".THEME."forum/yahoo.gif' alt='".$data['user_yahoo']."' style='border:0px;'></a> ";
		}
		if ($data['user_web']) {
			if (!strstr($data['user_web'], "http://")) { $urlprefix = "http://"; } else { $urlprefix = ""; }
			echo "<a href='".$urlprefix."".$data['user_web']."' target='_blank'><img src='".THEME."forum/web.gif' alt='".$data['user_web']."' style='border:0px;'></a> ";
		}
		echo "<a href='".BASEDIR."messages.php?msg_send=".$data['user_id']."'><img src='".THEME."forum/pm.gif' alt='".$locale['u060']."' style='border:0px;'></a>
</td>
                  </tr>";
      }
      echo "</table>";
   } else {
      echo "<center>".$locale['BUD103']."</center>";
   }
   echo "<br><div align='center'><a href='".BASEDIR."members.php' class='slink'>".$locale['BUD104']."</a></div>";
}
closetable();
//PahaW - buddy - end


3. Open the edit_profile.php File in an editor of your choice
and follow the steps :
--------------------------------------------------
a) Search for :
--------------------------------------------------
include LOCALE.LOCALESET."user_fields.php";

Add directly under the following :
--------------------------------------------------
if (file_exists(INFUSIONS."buddy_system_panel/locale/".$settings['locale'].".php")) {
include INFUSIONS."buddy_system_panel/locale/".$settings['locale'].".php";
} else {
include INFUSIONS."buddy_system_panel/locale/English.php";
}

if(iMEMBER && isset($lookup) && isset($removebuddy)){
dbquery("DELETE FROM ".$db_prefix."buddy WHERE buddy_user_id='".$userdata[user_id]."' AND buddy_buddy_id='".$lookup."'");
}

b) Search for :
--------------------------------------------------
</form>\n";
closetable();


Add directly under the following :
--------------------------------------------------

//PahaW - buddy - start
	tablebreak();
opentable($locale['BUD100']);
   $result=dbquery("SELECT user_id,user_name FROM ".$db_prefix."buddy LEFT JOIN ".$db_prefix."users ON buddy_buddy_id=user_id WHERE buddy_user_id='".$userdata['user_id']."' ORDER BY user_name ASC");
   if (dbrows($result)!=0){
       echo "<table align='center' cellpadding='0' cellspacing='0'>";
       while ($data=dbarray($result)){
             echo "<tr>
                    <td class='small' align='left'><a href='".BASEDIR."profile.php?lookup=".$data['user_id']."'>".$data['user_name']." </a></td>
                    <td class='small' align='right'>&nbsp;[ <a href='".BASEDIR."edit_profile.php?lookup=".$data['user_id']."&removebuddy'>".$locale['BUD105']."</a> ]</td></tr>";
       }
       echo "</table>";
   } else {
       echo "<center>".$locale['BUD103']."</center>";
   }
   echo "<br /><div align='center'><a href='".BASEDIR."members.php'>".$locale['BUD104']."</a></div>";
closetable();
//PahaW - buddy - end


4. Go to the Infusion Management in the Admin Panels and install the Infusion.
----------------------------------------------------------------------------------------------------
5. Go to the Panel Management and add a new Panel by choosing the File Name buddy_system_panel !
Dont forget to activate the new Panel.
----------------------------------------------------------------------------------------------------
Features
--------
* A complete Buddy List System (add and delete Buddy function)

