function combat_ticker($alliances, $users)
{
    $week = dlookup("week", "timeinfo");
    foreach ($users as $uid => $count) {
        ticker($uid, "*lbattlereport.php?act=show_own&_minw={$week}&_maxw={$week}*You were involved in " . $count . " battles!", "a");
    }
    foreach ($alliances as $aid => $count) {
        $members = get_alliance_members($aid);
        foreach ($members as $uid => $name) {
            // mop: gabs ausser den eigenen auch noch kämpfe?
            if ($count - $users[$uid] > 0) {
                ticker($uid, "*lbattlereport.php?act=show_alliance&_minw={$week}&_maxw={$week}*Your alliance was involved in " . ($count - $users[$uid]) . " battles!", "a");
            }
        }
    }
}
function resign()
{
    global $uid;
    $sth = mysql_query("select a.id,a.leader,a.devminister,a.milminister,a.forminister from alliance a,users u where u.alliance=a.id and u.id=" . $uid);
    if (!$sth || mysql_num_rows($sth) == 0) {
        show_error("ERR::GET INFOS");
        return false;
    }
    $alliance = mysql_fetch_assoc($sth);
    // mop: hatter denn nen posten?
    switch ($uid) {
        case $alliance["leader"]:
            $field = "leader";
            $text = "Leader";
            break;
        case $alliance["devminister"]:
            $field = "devminister";
            $text = "Minister of Development";
            break;
        case $alliance["forminister"]:
            $field = "forminister";
            $text = "Foreign Minister";
            break;
        case $alliance["milminister"]:
            $field = "milminister";
            $text = "Minister of Defence";
            break;
        default:
            $field = false;
    }
    if (!$field) {
        show_error("EVIL! EVIL!");
        return false;
    }
    $sth = mysql_query("update alliance set " . $field . "=0 where id=" . $alliance["id"]);
    if (!$sth) {
        show_error("ERR::RESIGN");
        return false;
    }
    show_menu();
    show_message("You have resigned as " . $text);
    // mop: leute informieren
    $members = get_alliance_members($alliance["id"]);
    foreach ($members as $uid => $name) {
        ticker($uid, "Your " . $text . " has resigned!", "w");
    }
}
 /**
  * speichert einen report
  * @param uid
  * @param report
  *      
  */
 function save_report($alliances, $uids, $battlefield, $report)
 {
     if (BATTLEREPORT_SHOW) {
         echo $report;
     } else {
         $sth = mysql_query("insert into battlereports set pid=" . $battlefield->pid . ",sid=" . $battlefield->sid . ",report='" . addslashes($report) . "',week=" . $this->week);
         if (!$sth) {
             echo "ERR::INSERT BATTLEREPORT\n";
             return false;
         }
         $rid = mysql_insert_id();
         // mop: allen allianzen zugänglich machen
         foreach ($alliances as $alliance) {
             $sth = mysql_query("insert into battlereports_alliance set aid=" . $alliance . ",rid=" . $rid);
             if (!$sth) {
                 echo "ERR::INSERT BATTLEREPORT_ALLIANCE\n";
                 return false;
             }
             // mop: die allianzmitglieder EINMAL über allianzkämpfe infomieren
             if (!in_array($alliance, $this->noticed_alliances)) {
                 $members = get_alliance_members($alliance);
                 foreach ($members as $uid => $name) {
                     // mop: beteiligte user bekommen eh nochmal ne separate message, also ausklammern
                     if (!in_array($uid, $uids)) {
                         ticker($uid, "*lbattlereport.php?act=show_alliance&_minw=" . $this->week . "&_maxw=" . $this->week . "*Your alliance was involved in one or more battles!", "a");
                     }
                 }
                 $this->noticed_alliances[] = $alliance;
             }
         }
         // mop: und auch den jeweiligen usern
         foreach ($uids as $uid) {
             $sth = mysql_query("insert into battlereports_user set uid=" . $uid . ",rid=" . $rid);
             if (!$sth) {
                 echo "ERR::INSERT BATTLEREPORT_UID\n";
                 return false;
             }
             if (!in_array($uid, $this->noticed_users)) {
                 ticker($uid, "*lbattlereport.php?act=show_own&_minw=" . $this->week . "&_maxw=" . $this->week . "*You were involved in one or more battles!", "a");
                 $this->noticed_users[] = $uid;
             }
         }
     }
 }