function notify_forum_users(&$objSrcUser, $posttype) { switch ($posttype) { case 0: // Alliance // One way to highlight a whole alliance -Martel, September 13, 2007 include_once 'inc/classes/clsUser.php'; $objTmpUser = new clsUser(1); //M:small performance increaser, reuse $objSrcAlliance = $objSrcUser->get_alliance(); $arrIds = $objSrcAlliance->get_userids(); foreach ($arrIds as $iUserId) { $objTmpUser->set_userid($iUserId); $objTmpUser->set_preference(NEW_A, 1); } break; case 1: // Staff // A way to highlight several alliances... There must be something // better, but now it works. Maybe add a method in alliance class // to affect all members. Martel, September 13, 2007 include_once 'inc/classes/clsUser.php'; $objTmpUser = new clsUser(1); //M:small performance increaser, reuse $strSQL = "SELECT id FROM " . TBL_STAT . " WHERE level > 1"; $resSQL = mysql_query($strSQL) or die(mysql_error()); while ($arrPrefs = mysql_fetch_array($resSQL)) { $objTmpUser->set_userid($arrPrefs[ID]); $objTmpUser->set_preference(NEW_S, 1); } break; case 2: // adding world entry - AI 31/10/06 // Note: This is bad, because we ignore user objects for performance mysql_query("UPDATE " . TBL_PREFERENCES . " SET " . NEW_W . " = 1 WHERE " . NEW_W . " = 0") or die(mysql_error()); break; case 3: // Announcements // Note: This is bad, because we ignore user objects for performance mysql_query("UPDATE " . TBL_PREFERENCES . " SET " . NEW_N . " = 1 WHERE " . NEW_N . " = 0") or die(mysql_error()); break; case 4: // Law & Order // One way to highlight a whole alliance -Martel, September 13, 2007 include_once 'inc/classes/clsUser.php'; $objTmpUser = new clsUser(1); //M:small performance increaser, reuse include_once 'inc/classes/clsAlliance.php'; $objSrcAlliance = new clsAlliance(2); // Hardcoded alliance id $arrIds = (array) $objSrcAlliance->get_userids(); foreach ($arrIds as $iUserId) { $objTmpUser->set_userid($iUserId); $objTmpUser->set_preference(NEW_L, 1); } break; case 5: // Operations // One way to highlight a whole alliance -Martel, September 13, 2007 include_once 'inc/classes/clsUser.php'; $objTmpUser = new clsUser(1); //M:small performance increaser, reuse include_once 'inc/classes/clsAlliance.php'; $objSrcAlliance = new clsAlliance(3); // Hardcoded alliance id $arrIds = (array) $objSrcAlliance->get_userids(); foreach ($arrIds as $iUserId) { $objTmpUser->set_userid($iUserId); $objTmpUser->set_preference(NEW_O, 1); } break; case 6: // Development // One way to highlight a whole alliance -Martel, September 13, 2007 include_once 'inc/classes/clsUser.php'; $objTmpUser = new clsUser(1); //M:small performance increaser, reuse include_once 'inc/classes/clsAlliance.php'; $objSrcAlliance = new clsAlliance(1); // Hardcoded alliance id $arrIds = (array) $objSrcAlliance->get_userids(); foreach ($arrIds as $iUserId) { $objTmpUser->set_userid($iUserId); $objTmpUser->set_preference(NEW_D, 1); } break; case 7: // Game Talk // Note: This is bad, because we ignore user objects for performance mysql_query("UPDATE " . TBL_PREFERENCES . " SET " . NEW_G . " = 1 WHERE " . NEW_G . " = 0") or die(mysql_error()); break; case 8: // Dragon Lair (game sponsors) $strLogins = "'martel'"; // hardcoded for sponsor notify SQL string $strSQL3 = "SELECT option_selection1 FROM phpsuppo_3.paypal WHERE option_selection1 != 'NULL' GROUP BY option_selection1"; $resSQL3 = mysql_query($strSQL3); while ($arrSQL3 = mysql_fetch_row($resSQL3)) { $strLogins .= ", " . quote_smart($arrSQL3[0]); } // A way to highlight several alliances... There must be something // better, but now it works. Maybe add a method in alliance class // to affect all members. Martel, September 13, 2007 include_once 'inc/classes/clsUser.php'; $objTmpUser = new clsUser(1); //M:small performance increaser, reuse $strSQL = "SELECT id FROM " . TBL_USER . " WHERE username IN ({$strLogins})"; $resSQL = mysql_query($strSQL) or die(mysql_error()); while ($arrPrefs = mysql_fetch_array($resSQL)) { $objTmpUser->set_userid($arrPrefs[ID]); $objTmpUser->set_preference(NEW_DR, 1); } break; } }