Advertisement
Guest User

Untitled

a guest
Jan 4th, 2022
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 223.01 KB | None | 0 0
  1. <?php
  2. if(!defined('INITIALIZED'))
  3.     exit;
  4.  
  5. if($action == "") {
  6.  
  7.     $guilds_list = new DatabaseList('Guild');
  8.     $guilds_list->addOrder(new SQL_Order(new SQL_Field('name'), SQL_Order::ASC));
  9.  
  10.     $main_content .= '
  11.         <div class="TableContainer" >
  12.             <table class="Table3" cellpadding="0" cellspacing="0" >
  13.                 <div class="CaptionContainer" >
  14.                     <div class="CaptionInnerContainer" >
  15.                         <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  16.                         <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  17.                         <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  18.                         <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  19.                         <div class="Text" >Active Guilds on ' .htmlspecialchars($config['server']['serverName']). '</div>
  20.                         <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  21.                         <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  22.                         <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  23.                         <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  24.                     </div>
  25.                 </div>
  26.                 <tr>
  27.                     <td><div class="InnerTableContainer" >
  28.                             <table style="width:100%;" >
  29.                                 <tr>
  30.                                     <td><div class="TableShadowContainerRightTop" >
  31.                                             <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rt.gif);" ></div>
  32.                                         </div>
  33.                                         <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rm.gif);" >
  34.                                             <div class="TableContentContainer" >
  35.                                                 <table class="TableContent" width="100%" >
  36.                                                     <TR BGCOLOR=#D4C0A1>
  37.                                                         <TD WIDTH=64><B>Logo</B></TD>
  38.                                                         <TD WIDTH=100%><B>Description</B></TD>
  39.                                                         <TD WIDTH=56><B>&#160;</B></TD>
  40.                                                     </TR>';
  41.                                                 $showed_guilds = 1;
  42.                                                 if(count($guilds_list) > 0)
  43.                                                 {
  44.                                                     foreach($guilds_list as $guild)
  45.                                                     {
  46.                                                         if(is_int($showed_guilds / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $showed_guilds++;
  47.                                                         $description = $guild->getDescription();
  48.                                                         $newlines   = array("\r\n", "\n", "\r");
  49.                                                         $description_with_lines = str_replace($newlines, '<br />', $description, $count);
  50.                                                         if($count < $config['site']['guild_description_lines_limit'])
  51.                                                             $description = $description_with_lines;
  52.                                                         $main_content .= '
  53.                                                             <TR BGCOLOR='.$bgcolor.'>
  54.                                                                 <TD><IMG SRC="'. $guild->getGuildLogoLink() .'" WIDTH=64 HEIGHT=64></TD>
  55.                                                                 <TD><B>'.htmlspecialchars($guild->getName()).'</B><BR>'.$description.'</TD>
  56.                                                                 <TD>
  57.                                                                     <table border="0" cellspacing="0" cellpadding="0" >
  58.                                                                         <form action="?subtopic=guilds&action=view" method="post" >
  59.                                                                             <tr>
  60.                                                                                 <td style="border:0px;" ><input type="hidden" name=GuildName value="'.htmlspecialchars($guild->getName()).'" >
  61.                                                                                     <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  62.                                                                                         <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  63.                                                                                             <input class="ButtonText" type="image" name="View" alt="View" src="'.$layout_name.'/images/global/buttons/_sbutton_view.gif" >
  64.                                                                                         </div>
  65.                                                                                     </div>
  66.                                                                                 </td>
  67.                                                                             </tr>
  68.                                                                         </form>';
  69.                                                                     if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
  70.                                                                         $main_content .= '
  71.                                                                         <form action="?subtopic=guilds&action=deletebyadmin" method="post">
  72.                                                                             <tr>
  73.                                                                                 <td style="border:0px;" >
  74.                                                                                     <input type="hidden" name="guild" value="'.$guild->getId().'">
  75.                                                                                     <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_red.gif)" >
  76.                                                                                         <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_red_over.gif);" ></div>
  77.                                                                                             <input class="ButtonText" type="image" name="Delete" alt="Delete" src="'.$layout_name.'/images/global/buttons/_sbutton_delete.gif" >
  78.                                                                                         </div>
  79.                                                                                     </div>
  80.                                                                                 </td>
  81.                                                                             </tr>
  82.                                                                         </form>';
  83.                                                                     $main_content .= '
  84.                                                                     </table>
  85.                                                                 </TD>
  86.                                                             </TR>';
  87.                                                     }
  88.                                                 }
  89.                                                 $main_content .= '
  90.                                                 </table>
  91.                                             </div>
  92.                                         </div>
  93.                                         <div class="TableShadowContainer" >
  94.                                             <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bm.gif);" >
  95.                                                 <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bl.gif);" ></div>
  96.                                                 <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-br.gif);" ></div>
  97.                                             </div>
  98.                                         </div>
  99.                                     </td>
  100.                                 </tr>
  101.                             </table>
  102.                         </div>
  103.                     </td>
  104.                 </tr>
  105.             </table>
  106.         </div>
  107.         <BR>
  108.         <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
  109.             <TR>
  110.                 <TD>No guild found that suits your needs?</TD>
  111.             </TR>
  112.             <TR>
  113.                 <TD><table border="0" cellspacing="0" cellpadding="0" >
  114.                         <form action="?subtopic=guilds&action=create" method="post" >
  115.                             <tr>
  116.                                 <td style="border:0px;" >
  117.                                     <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  118.                                         <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  119.                                             <input class="ButtonText" type="image" name="FoundGuild" alt="FoundGuild" src="'.$layout_name.'/images/global/buttons/_sbutton_foundguild.gif" >
  120.                                         </div>
  121.                                     </div>
  122.                                 </td>
  123.                             </tr>
  124.                         </form>
  125.                     </table>
  126.                 </TD>
  127.             </TR>
  128.         </TABLE>';
  129. }
  130. if($action == "view")
  131. {
  132.     $guild_name = (string) $_REQUEST['GuildName'];
  133.     $guild = new Guild();
  134.     $guild->loadByName($guild_name);
  135.     if(!$guild->isLoaded())
  136.         $guild_errors[] = 'Guild with name <b>'.$guild_name.'</b> doesn\'t exist.';
  137.  
  138.     if(!empty($guild_errors))
  139.     {
  140.         //errors
  141.             $main_content .= '
  142.                 <div class="TableContainer" >
  143.                     <table class="Table1" cellpadding="0" cellspacing="0" >
  144.                         <div class="CaptionContainer" >
  145.                             <div class="CaptionInnerContainer" >
  146.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  147.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  148.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  149.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  150.                                 <div class="Text" >Error</div>
  151.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  152.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  153.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  154.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  155.                             </div>
  156.                         </div>
  157.                         <tr>
  158.                             <td>
  159.                                 <div class="InnerTableContainer" >
  160.                                     <table style="width:100%;" >
  161.                                         <tr>
  162.                                             <td>';
  163.                                             foreach($guild_errors as $guild_error)
  164.                                                 $main_content .= '<p>'.$guild_error;
  165.                                         $main_content .= '
  166.                                             </td>
  167.                                         </tr>
  168.                                     </table>
  169.                                 </div>
  170.                             </td>
  171.                         </tr>
  172.                     </table>
  173.                 </div><BR>
  174.                 <TABLE BORDER=0 WIDTH=100%>
  175.                     <TR>
  176.                         <TD ALIGN=center>
  177.                             <table border="0" cellspacing="0" cellpadding="0" >
  178.                                 <form action="?subtopic=guilds" method="post" >
  179.                                     <tr>
  180.                                         <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  181.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  182.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  183.                                                 </div>
  184.                                             </div>
  185.                                         </td>
  186.                                     </tr>
  187.                                 </form>
  188.                             </table>
  189.                         </TD>
  190.                     </TR>
  191.                 </TABLE>';
  192.         //show errors
  193.     }
  194.     else
  195.     {
  196.         //check is it vice or/and leader account (leader has vice + leader rights)
  197.         $guild_leader_char = $guild->getOwner();
  198.         $rank_list = $guild->getGuildRanksList();
  199.         $guild_leader = FALSE;
  200.         $guild_vice = FALSE;
  201.         if($logged)
  202.         {
  203.             $account_players = $account_logged->getPlayers();
  204.             foreach($account_players as $player)
  205.             {
  206.                 $players_from_account_ids[] = $player->getId();
  207.                 $player_rank = $player->getRank();
  208.                 if(!empty($player_rank))
  209.                     foreach($rank_list as $rank_in_guild)
  210.                         if($rank_in_guild->getId() == $player_rank->getId())
  211.                         {
  212.                             $players_from_account_in_guild[] = $player->getName();
  213.                             if($player_rank->getLevel() > 1)
  214.                             {
  215.                                 $guild_vice = TRUE;
  216.                                 $level_in_guild = $player_rank->getLevel();
  217.                             }
  218.                             if($guild->getOwner()->getId() == $player->getId())
  219.                             {
  220.                                 $guild_vice = TRUE;
  221.                                 $guild_leader = TRUE;
  222.                             }
  223.                         }
  224.             }
  225.         }
  226.  
  227.         //show guild page
  228.         $description = $guild->getDescription();
  229.         $newlines   = array("\r\n", "\n", "\r");
  230.         $description_with_lines = str_replace($newlines, '<br />', $description, $count);
  231.         if($count < $config['site']['guild_description_lines_limit'])
  232.             $description = $description_with_lines;
  233.         $guild_owner = $guild->getOwner();
  234.         if($guild_owner->isLoaded())
  235.             $guild_owner = $guild_owner->getName();
  236.  
  237.         $main_content .= '
  238.             <TABLE BORDER=0 WIDTH=100%>
  239.                 <TR>
  240.                     <TD WIDTH=64><IMG SRC="' . $guild->getGuildLogoLink() . '" WIDTH=64 HEIGHT=64></TD>
  241.                     <TD ALIGN=center WIDTH=100%><H1>'.htmlspecialchars($guild->getName()).'</H1></TD>
  242.                     <TD WIDTH=64><IMG SRC="' . $guild->getGuildLogoLink() . '" WIDTH=64 HEIGHT=64></TD>
  243.                 </TR>
  244.             </TABLE>
  245.             <BR>
  246.             <TABLE Width=100%>
  247.                 <colgroup>
  248.                 <col width="90%">
  249.                 <col width="10%">
  250.                 </colgroup>
  251.                 <TR>
  252.                     <TD style="vertical-align:top; padding-right: 5px;"><div class="TableContainer" >
  253.                             <table class="Table1" cellpadding="0" cellspacing="0" >
  254.                                 <div class="CaptionContainer" >
  255.                                     <div class="CaptionInnerContainer" >
  256.                                         <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  257.                                         <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  258.                                         <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  259.                                         <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  260.                                         <div class="Text" >Guild Information</div>
  261.                                         <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  262.                                         <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  263.                                         <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  264.                                         <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  265.                                     </div>
  266.                                 </div>
  267.                                 <tr>
  268.                                     <td><div class="InnerTableContainer" >';
  269.                                     //show guild page
  270.                                     $description = $guild->getDescription();
  271.                                     $newlines   = array("\r\n", "\n", "\r");
  272.                                     $description_with_lines = str_replace($newlines, '<br />', $description, $count);
  273.                                     if($count < $config['site']['guild_description_lines_limit'])
  274.                                         $description = $description_with_lines;
  275.                                         $main_content .= '
  276.                                             <table style="width:100%;" >
  277.                                                 <TR>
  278.                                                     <TD>
  279.                                                         <div id="GuildInformationContainer">
  280.                                                             '.$description.'<br><br>
  281.                                                             The guild was founded on '.$config['server']['serverName'].' on '.date("M d Y",$guild->getCreateDate()).'.<BR>
  282.                                                             It is currently active.<BR>
  283.                                                         </div>
  284.                                                     </TD>
  285.                                                 </TR>
  286.                                             </table>
  287.                                         </div>
  288.                                     </td>
  289.                                 </tr>
  290.                             </table>
  291.                         </div>
  292.                     </TD>
  293.                     <TD style="vertical-align:top;">
  294.                         <div class="TableContainer" >
  295.                             <table class="Table1" cellpadding="0" cellspacing="0" >
  296.                                 <div class="CaptionContainer" >
  297.                                     <div class="CaptionInnerContainer" >
  298.                                         <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  299.                                         <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  300.                                         <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  301.                                         <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  302.                                         <div class="Text" >Navigation</div>
  303.                                         <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  304.                                         <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  305.                                         <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  306.                                         <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  307.                                     </div>
  308.                                 </div>
  309.                                 <tr>
  310.                                     <td>
  311.                                         <div class="InnerTableContainer" >
  312.                                             <table style="width:100%;" >
  313.                                                 <tr>
  314.                                                     <td align="center"><div id="NavigationContainer">
  315.                                                             <table border="0" cellspacing="0" cellpadding="0" >
  316.                                                                 <form action="?subtopic=guilds" method="post" >
  317.                                                                     <tr>
  318.                                                                         <td style="border:0px;" >
  319.                                                                             <input type="hidden" name=action value=guildwars >
  320.                                                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  321.                                                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  322.                                                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  323.                                                                                     <input class="ButtonText" type="image" name="Guild Wars" alt="Guild Wars" src="'.$layout_name.'/images/global/buttons/_sbutton_guildwars.gif" >
  324.                                                                                 </div>
  325.                                                                             </div>
  326.                                                                         </td>
  327.                                                                     </tr>
  328.                                                                 </form>
  329.                                                             </table>
  330.                                                             <div style="font-size:1px;height:4px;" ></div>
  331.                                                             <table border="0" cellspacing="0" cellpadding="0" >
  332.                                                                 <form action="?subtopic=guilds" method="post" >
  333.                                                                     <tr>
  334.                                                                         <td style="border:0px;" >
  335.                                                                             <input type="hidden" name=action value=guildevents >
  336.                                                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  337.                                                                             <input type="hidden" name=world value="Neptera" >
  338.                                                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  339.                                                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  340.                                                                                     <input class="ButtonText" type="image" name="Guild Events" alt="Guild Events" src="'.$layout_name.'/images/global/buttons/_sbutton_guildevents.gif" >
  341.                                                                                 </div>
  342.                                                                             </div>
  343.                                                                         </td>
  344.                                                                     </tr>
  345.                                                                 </form>
  346.                                                             </table>
  347.                                                             <div style="font-size:1px;height:4px;" ></div>
  348.                                                         </div>
  349.                                                     </td>
  350.                                                 </tr>
  351.                                             </table>
  352.                                         </div>
  353.                                     </td>
  354.                                 </tr>
  355.                             </table>
  356.                         </div>';
  357.                 if($guild_leader)
  358.                     $main_content .= '
  359.                         <div style="font-size:1px;height:6px;" ></div>
  360.                         <div class="TableContainer" >
  361.                             <table class="Table1" cellpadding="0" cellspacing="0" >
  362.                                 <div class="CaptionContainer" >
  363.                                     <div class="CaptionInnerContainer" >
  364.                                         <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  365.                                         <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  366.                                         <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  367.                                         <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  368.                                         <div class="Text" >Administration</div>
  369.                                         <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  370.                                         <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  371.                                         <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  372.                                         <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  373.                                     </div>
  374.                                 </div>
  375.                                 <tr>
  376.                                     <td><div class="InnerTableContainer" >
  377.                                             <table style="width:100%;" >
  378.                                                 <TR>
  379.                                                     <TD align="center">
  380.                                                         <div id="AdministrationContainer">
  381.                                                             <table border="0" cellspacing="0" cellpadding="0" >
  382.                                                                 <form action="?subtopic=guilds" method="post" >
  383.                                                                     <tr>
  384.                                                                         <td style="border:0px;" >
  385.                                                                             <input type="hidden" name=action value=description >
  386.                                                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  387.                                                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  388.                                                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  389.                                                                                     <input class="ButtonText" type="image" name="Edit Description" alt="Edit Description" src="'.$layout_name.'/images/global/buttons/_sbutton_editdescription.gif" >
  390.                                                                                 </div>
  391.                                                                             </div>
  392.                                                                         </td>
  393.                                                                     </tr>
  394.                                                                 </form>
  395.                                                             </table>
  396.                                                             <div style="font-size:1px;height:4px;" ></div>
  397.                                                             <table border="0" cellspacing="0" cellpadding="0" >
  398.                                                                 <form action="?subtopic=guilds" method="post" >
  399.                                                                     <tr>
  400.                                                                         <td style="border:0px;" >
  401.                                                                             <input type="hidden" name=action value=disband >
  402.                                                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  403.                                                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  404.                                                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  405.                                                                                     <input class="ButtonText" type="image" name="Disband Guild" alt="Disband Guild" src="'.$layout_name.'/images/global/buttons/_sbutton_disbandguild.gif" >
  406.                                                                                 </div>
  407.                                                                             </div>
  408.                                                                         </td>
  409.                                                                     </tr>
  410.                                                                 </form>
  411.                                                             </table>
  412.                                                             <div style="font-size:1px;height:4px;" ></div>
  413.                                                             <table border="0" cellspacing="0" cellpadding="0" >
  414.                                                                 <form action="?subtopic=guilds" method="post" >
  415.                                                                     <tr>
  416.                                                                         <td style="border:0px;" >
  417.                                                                             <input type="hidden" name=action value=resignleadership >
  418.                                                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  419.                                                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  420.                                                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  421.                                                                                     <input class="ButtonText" type="image" name="Resign Leadership" alt="Resign Leadership" src="'.$layout_name.'/images/global/buttons/_sbutton_resignleadership.gif" >
  422.                                                                                 </div>
  423.                                                                             </div>
  424.                                                                         </td>
  425.                                                                     </tr>
  426.                                                                 </form>
  427.                                                             </table>
  428.                                                         </div>
  429.                                                     </td>
  430.                                                 </tr>
  431.                                             </table>
  432.                                         </div>
  433.                                     </td>
  434.                                 </tr>
  435.                             </table>
  436.                         </div>';
  437.                 $main_content .= '
  438.                     </TD>
  439.                 </TR>
  440.             </TABLE>
  441.             <script type="text/javascript" >
  442.             $(document).ready(function() {
  443.                 var g_GuildInformationContainerHeight = $(\'#GuildInformationContainer\').height();
  444.                 if($(\'#AdministrationContainer\').length > 0) {
  445.                   var g_AdministrationContainerHeight = $(\'#AdministrationContainer\').height() + 28;
  446.                   var g_NavigationContainerHeight = $(\'#NavigationContainer\').height() + 28;
  447.                 } else {
  448.                   var g_NavigationContainerHeight = $(\'#NavigationContainer\').height();
  449.                   var g_AdministrationContainerHeight = 0;
  450.                 }
  451.                 //alert(g_GuildInformationContainerHeight+\' \'+g_NavigationContainerHeight+\' \'+g_AdministrationContainerHeight);
  452.                 if(g_GuildInformationContainerHeight < g_NavigationContainerHeight + g_AdministrationContainerHeight) {
  453.                   $(\'#GuildInformationContainer\').css(\'height\', g_NavigationContainerHeight + g_AdministrationContainerHeight);
  454.                 } else {
  455.                   if($(\'#AdministrationContainer\').length > 0) {
  456.                     $(\'#NavigationContainer\').css(\'height\', g_GuildInformationContainerHeight * 0.7 - 28);
  457.                     $(\'#AdministrationContainer\').css(\'height\', g_GuildInformationContainerHeight * 0.3 - 28);
  458.                   } else {
  459.                     $(\'#NavigationContainer\').css(\'height\', g_GuildInformationContainerHeight);
  460.                   }
  461.                 }
  462.               });</script>
  463.             <BR>
  464.             <div class="TableContainer" >
  465.                 <table class="Table3" cellpadding="0" cellspacing="0" >
  466.                     <div class="CaptionContainer" >
  467.                         <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" />
  468.                                 </span>
  469.                             <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" />
  470.                                 </span>
  471.                             <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" />
  472.                                 </span>
  473.  
  474.                             <div class="Text" >Guild Members</div>
  475.                             <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" />
  476.                                 </span>
  477.                             <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" />
  478.                                 </span>
  479.                             <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" />
  480.                                 </span>
  481.                         </div>
  482.                     </div>
  483.                     <tr>
  484.                             <td>
  485.                         <div class="InnerTableContainer" >
  486.                             <table style="width:100%;" >
  487.                                 <tr><td>
  488.                                     <div class="TableShadowContainerRightTop" >
  489.                                         <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rt.gif);" ></div>
  490.                                     </div>
  491.                                     <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rm.gif);" >
  492.                                         <div class="TableContentContainer" >
  493.                                             <table class="TableContent" width="100%" >
  494.                                                 <tr class="LabelH">
  495.                                                     <td>Rank <small style="font-weight:normal;" >[<a href="#" >sort</a>]</small>
  496.                                                     <img class="sortarrow" src="'.$layout_name.'/images/global/content/order_desc.gif" /></td>
  497.                                                     <td>Name and Title</td>
  498.                                                     <td>Vocation <small style="font-weight:normal;" >[<a href="#" >sort</a>]</small>
  499.                                                     <img class="sortarrow" src="'.$layout_name.'/images/global/general/blank.gif" /></td>
  500.                                                     <td>Level <small style="font-weight:normal;" >[<a href="#" >sort</a>]</small>
  501.                                                     <img class="sortarrow" src="'.$layout_name.'/images/global/general/blank.gif" /></td>
  502.                                                     <td>Status</td>
  503.                                                 </tr>';
  504.                                             #show players
  505.                                             $showed_players = 1;
  506.                                             foreach($rank_list as $rank) {
  507.                                                 $oi = 0;
  508.                                                 if(!isset($_REQUEST['onlyshowonline']) || $_REQUEST['onlyshowonline'] == 0)
  509.                                                     $players_with_rank = $rank->getPlayersList();
  510.                                                 else
  511.                                                     $players_with_rank = $rank->getOnlinePlayersList();
  512.                                                 $players_with_rank_number = count($players_with_rank);
  513.                                                 if($players_with_rank_number > 0) {
  514.                                                     if(is_int($showed_players / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; }
  515.                                                     $showed_players++;
  516.                                                     foreach($players_with_rank as $player) {
  517.                                                         $oi++;
  518.                                                         $main_content .= '
  519.                                                             <TR BGCOLOR='.$bgcolor.'>
  520.                                                                 <TD>'.(($oi == 1) ? htmlspecialchars($rank->getName()) : '').'</TD>
  521.                                                                 <TD>
  522.                                                                     <A HREF="?subtopic=characters&name='.urlencode($player->getName()).'">'.htmlspecialchars($player->getName()).'</A>';
  523.                                                                     if ($player->getGuildNick() != "")
  524.                                                                         $main_content .= ' (' . $player->getGuildNick() . ')';
  525.                                                             $main_content .= '
  526.                                                                 </TD>
  527.                                                                     <TD>' . htmlspecialchars(Website::getVocationName($player->getVocation())) . '</TD>
  528.                                                                     <TD>' . htmlspecialchars($player->getLevel()) . '</TD>
  529.                                                                     <TD class="onlinestatus"><span '.((!$player->isOnline()) ? 'class="red"' : 'class="green"').'>'.((!$player->isOnline()) ? 'offline' : '<strong>online</strong>').'</span>
  530.                                                                 </TD>
  531.                                                             </TR>';
  532.                                                     }
  533.                                                 }
  534.                                             }
  535.                                             $main_content .= '
  536.                                             </table>
  537.                                         </div>
  538.                                     </div>
  539.                                     <div class="TableShadowContainer" >
  540.                                         <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bm.gif);" >
  541.                                             <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bl.gif);" ></div>
  542.                                             <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-br.gif);" ></div>
  543.                                         </div>
  544.                                     </div>
  545.                                         </td>
  546.                                 </tr>
  547.                                 <tr>
  548.                                     <td>';
  549.                                 if(!isset($_REQUEST['onlyshowonline']) || $_REQUEST['onlyshowonline'] == 0)
  550.                                     $main_content .= '
  551.                                         <table class="InnerTableButtonRow" cellpadding="0" cellspacing="0" >
  552.                                             <tr>
  553.                                                 <td></td>
  554.                                                 <td align="right" style="padding-right:7px;width:100%;" >
  555.                                                     <form action="?subtopic=guilds" method="post" style="padding:0px;margin:0px;" >
  556.                                                         <input type="hidden" name="action" value="view" >
  557.                                                         <input type="hidden" name="onlyshowonline" value="1" >
  558.                                                         <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'" >
  559.                                                         <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  560.                                                             <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  561.                                                                 <input class="ButtonText" type="image" name="Show Online" alt="Show Online" src="'.$layout_name.'/images/global/buttons/_sbutton_showonline.gif" >
  562.                                                             </div>
  563.                                                         </div>
  564.                                                     </form>
  565.                                                 </td>
  566.                                             </tr>
  567.                                         </table>';
  568.                                 else
  569.                                     $main_content .= '
  570.                                         <table class="InnerTableButtonRow" cellpadding="0" cellspacing="0" >
  571.                                             <tr>
  572.                                                 <td></td>
  573.                                                 <td align="right" style="padding-right:7px;width:100%;" >
  574.                                                     <form action="?subtopic=guilds" method="post" style="padding:0px;margin:0px;" >
  575.                                                         <input type="hidden" name="action" value="view" >
  576.                                                         <input type="hidden" name="onlyshowonline" value="0" >
  577.                                                         <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'" >
  578.                                                         <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  579.                                                             <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  580.                                                                 <input class="ButtonText" type="image" name="Show All" alt="Show All" src="'.$layout_name.'/images/global/buttons/_sbutton_showall.gif" >
  581.                                                             </div>
  582.                                                         </div>
  583.                                                     </form>
  584.                                                 </td>
  585.                                             </tr>
  586.                                         </table>';
  587.                                 $main_content .= '
  588.                                     </td>
  589.                                 </tr>
  590.                             </table>
  591.                         </div>
  592.                         </td>
  593.                     </tr>
  594.                 </table>
  595.             </div>';
  596.         if($logged) {
  597.             $main_content .= '
  598.                 <TABLE BORDER=0 class="fixed">
  599.                     <TR>
  600.                     <col width="140px">
  601.                     <col width="140px">
  602.                     <col width="140px">
  603.                     <col width="140px">
  604.                     <col width="140px">
  605.                     <col width="140px">';
  606.                 if($guild_vice)
  607.                     $main_content .= '
  608.                         <TD>
  609.                             <table border="0" cellspacing="0" cellpadding="0" >
  610.                                 <form action="?subtopic=guilds" method="post" >
  611.                                     <tr>
  612.                                         <td style="border:0px;" >
  613.                                             <input type="hidden" name=action value=members >
  614.                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  615.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  616.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  617.                                                     <input class="ButtonText" type="image" name="Edit Members" alt="Edit Members" src="'.$layout_name.'/images/global/buttons/_sbutton_editmembers.gif" >
  618.                                                 </div>
  619.                                             </div>
  620.                                         </td>
  621.                                     </tr>
  622.                                 </form>
  623.                             </table>
  624.                         </TD>';
  625.                     if($guild_leader)
  626.                     #Edit players ranks
  627.                         $main_content .= '
  628.                             <TD>
  629.                                 <table border="0" cellspacing="0" cellpadding="0" >
  630.                                     <form action="?subtopic=guilds" method="post" >
  631.                                         <tr>
  632.                                             <td style="border:0px;" >
  633.                                                 <input type="hidden" name=action value=ranks >
  634.                                                 <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  635.                                                 <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  636.                                                     <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  637.                                                         <input class="ButtonText" type="image" name="Edit Ranks" alt="Edit Ranks" src="'.$layout_name.'/images/global/buttons/_sbutton_editranks.gif" >
  638.                                                     </div>
  639.                                                 </div>
  640.                                             </td>
  641.                                         </tr>
  642.                                     </form>
  643.                                 </table>
  644.                             </TD>';
  645.                 if($players_from_account_in_guild > 0)
  646.                         $main_content .= '
  647.                             <TD>
  648.                                 <table border="0" cellspacing="0" cellpadding="0" >
  649.                                     <form action="?subtopic=guilds" method="post" >
  650.                                         <tr>
  651.                                             <td style="border:0px;" >
  652.                                                 <input type="hidden" name=action value=leave >
  653.                                                 <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  654.                                                 <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  655.                                                     <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  656.                                                         <input class="ButtonText" type="image" name="Leave Guild" alt="Leave Guild" src="'.$layout_name.'/images/global/buttons/_sbutton_leaveguild.gif" >
  657.                                                     </div>
  658.                                                 </div>
  659.                                             </td>
  660.                                         </tr>
  661.                                     </form>
  662.                                 </table>
  663.                             </TD>';
  664.                 $main_content .= '
  665.                     </TR>
  666.                 </TABLE>';
  667.         }
  668.         $main_content .= '
  669.         <BR>
  670.             <div class="TableContainer" >
  671.                 <table class="Table3" cellpadding="0" cellspacing="0" >
  672.                     <div class="CaptionContainer" >
  673.                         <div class="CaptionInnerContainer" >
  674.                             <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  675.                             <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  676.                             <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  677.                             <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  678.                             <div class="Text" >Invited Characters</div>
  679.                             <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  680.                             <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  681.                             <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  682.                             <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  683.                         </div>
  684.                     </div>
  685.                     <tr>
  686.                         <td><div class="InnerTableContainer" >
  687.                                 <table style="width:100%;" >
  688.                                     <tr>
  689.                                         <td>
  690.                                             <div class="TableShadowContainerRightTop" >
  691.                                                 <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rt.gif);" ></div>
  692.                                             </div>
  693.                                             <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rm.gif);" >
  694.                                                 <div class="TableContentContainer" >
  695.                                                     <table class="TableContent" width="100%" >';
  696.                                                 $invited_list = $guild->listInvites();
  697.                                                 if(count($invited_list) == 0)
  698.                                                     $main_content .= '
  699.                                                         <TR BGCOLOR=#F1E0C6>
  700.                                                             <TD>No invited characters found.</TD>
  701.                                                         </TR>';
  702.                                                 else {
  703.                                                     $main_content .= '
  704.                                                         <TR BGCOLOR=#D4C0A1>
  705.                                                             <TD WIDTH=70%><B>Name</B></TD>
  706.                                                             <TD WIDTH=30%><B>Invitation Date</B></TD>
  707.                                                         </TR>';
  708.                                                     $show_accept_invite = 0;
  709.                                                     $showed_invited = 1;
  710.                                                     foreach($invited_list as $invited_player) {
  711.                                                         if(count($account_players) > 0)
  712.                                                             foreach($account_players as $player_from_acc)
  713.                                                                 if($player_from_acc->getName() == $invited_player->getName())
  714.                                                                     $show_accept_invite++;
  715.                                                         if(is_int($showed_invited / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $showed_invited++;
  716.                                                         $main_content .= '
  717.                                                             <TR BGCOLOR='.$bgcolor.'>
  718.                                                                 <TD><A HREF="?subtopic=characters&name='.urlencode($invited_player->getName()).'">'.htmlspecialchars($invited_player->getName()).'</A></TD>';
  719.                                                             $invitedID = $invited_player->getId();
  720.                                                             $getInviteDate = filter_var($getInviteDate, FILTER_SANITIZE_STRING);
  721.                                                             $getInviteDate = $SQL->query("SELECT `date` FROM `guild_invites` WHERE `player_id` = '$invitedID'")->fetch();
  722.                                                             $main_content .= '
  723.                                                                 <TD>'.date("M d Y",$getInviteDate['date']).'</TD>
  724.                                                             </TR>';
  725.                                                     }
  726.  
  727.                                                 }
  728.                                                 $main_content .= '
  729.                                                     </table>
  730.                                                 </div>
  731.                                             </div>
  732.                                             <div class="TableShadowContainer" >
  733.                                                 <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bm.gif);" >
  734.                                                     <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bl.gif);" ></div>
  735.                                                     <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-br.gif);" ></div>
  736.                                                 </div>
  737.                                             </div>
  738.                                         </td>
  739.                                     </tr>
  740.                                 </table>
  741.                             </div>
  742.                         </td>
  743.                     </tr>
  744.                 </table>
  745.             </div>';
  746.  
  747.             $main_content .= '
  748.                 <TABLE BORDER=0 class="fixed">
  749.                     <col width="140px">
  750.                     <col width="140px">
  751.                     <col width="140px">
  752.                     <col width="140px">
  753.                     <col width="140px">
  754.                     <TR>';
  755.                 if($guild_vice)
  756.                     $main_content .= '
  757.                         <TD><table border="0" cellspacing="0" cellpadding="0" >
  758.                                 <form action="?subtopic=guilds" method="post" >
  759.                                     <tr>
  760.                                         <td style="border:0px;" >
  761.                                             <input type="hidden" name=action value=invite >
  762.                                             <input type="hidden" name=GuildName value="'.$guild->getName().'" >
  763.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  764.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  765.                                                     <input class="ButtonText" type="image" name="Invite Character" alt="Invite Character" src="'.$layout_name.'/images/global/buttons/_sbutton_invitecharacter.gif" >
  766.                                                 </div>
  767.                                             </div>
  768.                                         </td>
  769.                                     </tr>
  770.                                 </form>
  771.                             </table>
  772.                         </TD>';
  773.                 if($show_accept_invite > 0)
  774.                     $main_content .= '
  775.                         <TD>
  776.                             <table border="0" cellspacing="0" cellpadding="0" >
  777.                                 <form action="?subtopic=guilds" method="post" >
  778.                                     <tr>
  779.                                         <td style="border:0px;" >
  780.                                             <input type="hidden" name=action value=join >
  781.                                             <input type="hidden" name=GuildName value="'.$guild->getName().'" >
  782.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  783.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  784.                                                     <input class="ButtonText" type="image" name="Join Guild" alt="Join Guild" src="'.$layout_name.'/images/global/buttons/_sbutton_joinguild.gif" >
  785.                                                 </div>
  786.                                             </div>
  787.                                         </td>
  788.                                     </tr>
  789.                                 </form>
  790.                             </table>
  791.                         </TD>';
  792.                 $main_content .= '
  793.                     </TR>
  794.                 </TABLE>';
  795.         $main_content .= '
  796.             <BR>
  797.             <TABLE BORDER=0 WIDTH=100%>
  798.                 <TR>
  799.                     <TD ALIGN=center><IMG SRC="'.$layout_name.'/images/global/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD>
  800.                     <TD ALIGN="center">
  801.                         <form action="?subtopic=guilds" method="post" style="padding:0px;margin:0px;" >
  802.                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  803.                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  804.                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  805.                                 </div>
  806.                             </div>
  807.                         </form>
  808.                     </TD>
  809.                     <TD ALIGN=center><IMG SRC="'.$layout_name.'/images/global/general/blank.gif" WIDTH=80 HEIGHT=1 BORDER=0<BR></TD>
  810.                 </TR>
  811.             </TABLE>';
  812.     }
  813. }
  814. if($action == "create") {
  815.     $guild_name = trim($_REQUEST['name']);
  816.     $leader = $_REQUEST['leader'];
  817.     $todo = $_REQUEST['todo'];
  818.     $guild_password = trim($_REQUEST['password']);
  819.     if(!$logged)
  820.         $guild_errors[] = 'You are not logged in. You can\'t create guild.';
  821.     if(empty($guild_errors))
  822.     {
  823.         $account_players = $account_logged->getPlayers();
  824.         foreach($account_players as $player)
  825.         {
  826.             $player_rank = $player->getRank();
  827.             if(empty($player_rank))
  828.                 if($player->getLevel() >= $config['site']['guild_need_level'])
  829.                     if(!$config['site']['guild_need_pacc'] || $account_logged->isPremium())
  830.                         $array_of_player_nig[] = $player->getName();
  831.         }
  832.     }
  833.     if(count($array_of_player_nig) == 0)
  834.         $guild_errors[] = 'On your account all characters are in guilds or have too low level to create new guild.';
  835.     if($todo == "save") {
  836.         if(!check_guild_name($guild_name)) {
  837.             $guild_errors[] = 'Invalid guild name format.';
  838.         }
  839.         if(!check_name($leader)) {
  840.             $guild_errors[] = 'Invalid character name format.';
  841.         }
  842.         if(empty($guild_errors)) {
  843.             $player = new Player();
  844.             $player->find($leader);
  845.             if(!$player->isLoaded())
  846.                 $guild_errors[] = 'Character <b>'.htmlspecialchars($leader).'</b> doesn\'t exist.';
  847.         }
  848.         if(empty($guild_errors)) {
  849.             $guild = new Guild();
  850.             $guild->find($guild_name);
  851.             if($guild->isLoaded())
  852.                 $guild_errors[] = 'Guild <b>'.htmlspecialchars($guild_name).'</b> already exist. Select other name.';
  853.         }
  854.         if(empty($guild_errors)) {
  855.             $bad_char = TRUE;
  856.             foreach($array_of_player_nig as $nick_from_list)
  857.                 if($nick_from_list == $player->getName())
  858.                     $bad_char = FALSE;
  859.             if($bad_char)
  860.                 $guild_errors[] = 'Character <b>'.htmlspecialchars($leader).'</b> isn\'t on your account or is already in guild.';
  861.         }
  862.         if(empty($guild_errors)) {
  863.             if($player->getLevel() < $config['site']['guild_need_level'])
  864.                 $guild_errors[] = 'Character <b>'.htmlspecialchars($leader).'</b> has too low level. To create guild you need character with level <b>'.$config['site']['guild_need_level'].'</b>.';
  865.             if($config['site']['guild_need_pacc'] && !$account_logged->isPremium())
  866.                 $guild_errors[] = 'Character <b>'.htmlspecialchars($leader).'</b> is on FREE account. To create guild you need PREMIUM account.';
  867.         }
  868.         if(empty($guild_errors)) {
  869.             if (!$account_logged->isValidPassword($guild_password))
  870.                 $guild_errors[] = 'Wrong password, please check it and try again.';
  871.         }
  872.     }
  873.  
  874.     if(!empty($guild_errors)) {
  875.         $main_content .= '
  876.             <div class="TableContainer" >
  877.                 <table class="Table1" cellpadding="0" cellspacing="0" >
  878.                     <div class="CaptionContainer" >
  879.                         <div class="CaptionInnerContainer" >
  880.                             <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  881.                             <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  882.                             <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  883.                             <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  884.                             <div class="Text" >Error</div>
  885.                             <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  886.                             <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  887.                             <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  888.                             <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  889.                         </div>
  890.                     </div>
  891.                     <tr>
  892.                         <td>
  893.                             <div class="InnerTableContainer" >
  894.                                 <table style="width:100%;" >
  895.                                     <tr>
  896.                                         <td>';
  897.                                     foreach($guild_errors as $guild_error)
  898.                                         $main_content .= '<p>'.$guild_error.'</p>';
  899.                                     $main_content .= '
  900.                                         </td>
  901.                                     </tr>
  902.                                 </table>
  903.                             </div>
  904.                         </td>
  905.                     </tr>
  906.                 </table>
  907.             </div><BR>
  908.             <TABLE BORDER=0 WIDTH=100%>
  909.                 <TR>
  910.                     <TD ALIGN=center>
  911.                         <table border="0" cellspacing="0" cellpadding="0" >
  912.                             <form action="?subtopic=guilds" method="post" >
  913.                                 <tr>
  914.                                     <td style="border:0px;" >';
  915.                                     if ($logged)
  916.                                         if(count($array_of_player_nig) > 0)
  917.                                             $main_content .= '
  918.                                                 <input type="hidden" name=action value=create >';
  919.                                     $main_content .= '
  920.                                         <input type="hidden" name=name value="'.$guild_name.'" >
  921.                                         <input type="hidden" name=leader value="'.$leader.'" >
  922.                                         <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  923.                                             <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  924.                                                 <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  925.                                             </div>
  926.                                         </div>
  927.                                     </td>
  928.                                 </tr>
  929.                             </form>
  930.                         </table>
  931.                     </TD>
  932.                 </TR>
  933.             </TABLE>';
  934.     } else {
  935.         if($todo == "save")
  936.         {
  937.             $new_guild = new Guild();
  938.             $new_guild->setCreationData(time());
  939.             $new_guild->setCreateIP(Visitor::getIP());
  940.             $new_guild->setName($guild_name);
  941.             $new_guild->setOwner($player);
  942.             $new_guild->setDescription('New guild. Leader must edit this text :)');
  943.             $new_guild->setGuildLogo('image/gif', Website::getFileContents('./images/guildlogos/default_logo.gif'));
  944.  
  945.             $new_guild->save();
  946.             $ranks = $new_guild->getGuildRanksList(true);
  947.             foreach($ranks as $rank)
  948.                 if($rank->getLevel() == 3)
  949.                 {
  950.                     $player->setRank($rank);
  951.                     $player->save();
  952.                 }
  953.             $main_content .= '
  954.                 <div class="TableContainer" >
  955.                     <table class="Table1" cellpadding="0" cellspacing="0" >
  956.                         <div class="CaptionContainer" >
  957.                             <div class="CaptionInnerContainer" >
  958.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  959.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  960.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  961.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  962.                                 <div class="Text" >Guild Founded!</div>
  963.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  964.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  965.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  966.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  967.                             </div>
  968.                         </div>
  969.                         <tr>
  970.                             <td>
  971.                                 <div class="InnerTableContainer" >
  972.                                     <table style="width:100%;" >
  973.                                         <tr>
  974.                                             <td>You have founded the '.htmlspecialchars($guild_name).'. Now go ahead and invite the first members.</td>
  975.                                         </tr>
  976.                                     </table>
  977.                                 </div>
  978.                             </td>
  979.                         </tr>
  980.                     </table>
  981.                 </div><br>
  982.                 <TABLE BORDER=0 WIDTH=100%>
  983.                     <TR>
  984.                         <TD ALIGN=center>
  985.                             <table border="0" cellspacing="0" cellpadding="0" >
  986.                                 <form action="?subtopic=guilds" method="post" >
  987.                                     <tr>
  988.                                         <td style="border:0px;" >
  989.                                             <input type="hidden" name=action value=view >
  990.                                             <input type="hidden" name=GuildName value="'.$guild_name.'" >
  991.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  992.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  993.                                                     <input class="ButtonText" type="image" name="Continue" alt="Continue" src="'.$layout_name.'/images/global/buttons/_sbutton_continue.gif" >
  994.                                                 </div>
  995.                                             </div>
  996.                                         </td>
  997.                                     </tr>
  998.                                 </form>
  999.                             </table>
  1000.                         </TD>
  1001.                     </TR>
  1002.                 </TABLE>';
  1003.         } else {
  1004.             #form to create
  1005.             $main_content .= 'Do you want to found a new guild? none of your characters may hold one of the two highest ranks in any other guild.<BR><BR>Now enter the name of the new guild, specify the name of your character that should become the first leader and confirm with your account password. Then click on "Submit". Note that the first two data cannot be changed later.<BR><BR>';
  1006.             $main_content .= '
  1007.                 <FORM ACTION="?subtopic=guilds" METHOD="post">
  1008.                 <div class="TableContainer" >
  1009.                     <table class="Table1" cellpadding="0" cellspacing="0" >
  1010.                         <div class="CaptionContainer" >
  1011.                             <div class="CaptionInnerContainer" >
  1012.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1013.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1014.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1015.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1016.                                 <div class="Text" >Found Guild</div>
  1017.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1018.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1019.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1020.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1021.                             </div>
  1022.                         </div>
  1023.                         <tr>
  1024.                             <td>
  1025.                                 <div class="InnerTableContainer" >
  1026.                                     <table style="width:100%;" >
  1027.                                         <TR>
  1028.                                             <TD BGCOLOR=#D4C0A1>
  1029.                                                 <TABLE BORDER=0 CELLPADDING=1>
  1030.                                                     <TR>
  1031.                                                         <TD>Guild Name:</TD>
  1032.                                                         <TD><INPUT NAME="name" VALUE="'.$_REQUEST['name'].'" SIZE=30 MAXLENGTH=29></TD>
  1033.                                                     </TR>
  1034.                                                     <TR>
  1035.                                                         <TD>Leader:</TD>
  1036.                                                         <TD>
  1037.                                                             <SELECT NAME="leader">';
  1038.                                                                 if(count($array_of_player_nig) > 0) {
  1039.                                                                     sort($array_of_player_nig);
  1040.                                                                     foreach($array_of_player_nig as $nick)
  1041.                                                                         $main_content .= '<OPTION>'.htmlspecialchars($nick).'</OPTION>';
  1042.                                                                 }
  1043.                                                         $main_content .= '
  1044.                                                             </SELECT>
  1045.                                                         </TD>
  1046.                                                     </TR>
  1047.                                                     <TR>
  1048.                                                         <TD>Password:</TD>
  1049.                                                         <TD><INPUT TYPE=password NAME="password" SIZE=30 MAXLENGTH=29></TD>
  1050.                                                     </TR>
  1051.                                                 </TABLE>
  1052.                                             </TD>
  1053.                                         </TR>
  1054.                                     </table>
  1055.                                 </div>
  1056.                             </td>
  1057.                         </tr>
  1058.                     </table>
  1059.                 </div><BR>
  1060.                 <TABLE BORDER=0 WIDTH=100%>
  1061.                     <TR>
  1062.                         <TD ALIGN=center><IMG SRC="'.$layout_name.'/images/global/general/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR></TD>
  1063.                         <TD ALIGN=center>
  1064.                             <table border="0" cellspacing="0" cellpadding="0" >
  1065.                                 <tr>
  1066.                                     <td style="border:0px;" >
  1067.                                         <input type="hidden" name="todo" value="save" >
  1068.                                         <input type="hidden" name="action" value="create" >
  1069.                                         <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  1070.                                             <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  1071.                                                 <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
  1072.                                             </div>
  1073.                                         </div>
  1074.                                     </td>
  1075.                                 <tr>
  1076.                             </form>
  1077.                             </table>
  1078.                         </TD>
  1079.                         <TD ALIGN=center>
  1080.                             <table border="0" cellspacing="0" cellpadding="0" >
  1081.                                 <form action="?subtopic=guilds" method="post" >
  1082.                                     <tr>
  1083.                                         <td style="border:0px;" >
  1084.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  1085.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  1086.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  1087.                                                 </div>
  1088.                                             </div>
  1089.                                         </td>
  1090.                                     </tr>
  1091.                                 </form>
  1092.                             </table>
  1093.                         </TD>
  1094.                         <TD ALIGN=center><IMG SRC="'.$layout_name.'/images/global/general/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR></TD>
  1095.                     </TR>
  1096.                 </TABLE>';
  1097.         }
  1098.     }
  1099. }
  1100. if ($action == "invite") {
  1101.     //set rights in guild
  1102.     $guild_name = (string) $_REQUEST['GuildName'];
  1103.     $name = $_REQUEST['character'];
  1104.     if(!$logged)
  1105.         $guild_errors[] = 'You are not logged in. You can\'t invite players.';
  1106.     if(empty($guild_errors))
  1107.     {
  1108.         $guild = new Guild();
  1109.         $guild->loadByName($guild_name);
  1110.         if(!$guild->isLoaded())
  1111.             $guild_errors[] = 'Guild with ID <b>'.$guild_id.'</b> doesn\'t exist.';
  1112.     }
  1113.     if(empty($guild_errors))
  1114.     {
  1115.         $rank_list = $guild->getGuildRanksList();
  1116.         $guild_leader = FALSE;
  1117.         $guild_vice = FALSE;
  1118.         $account_players = $account_logged->getPlayers();
  1119.         foreach($account_players as $player)
  1120.         {
  1121.             $player_rank = $player->getRank();
  1122.             if(!empty($player_rank))
  1123.                 foreach($rank_list as $rank_in_guild)
  1124.                     if($rank_in_guild->getId() == $player_rank->getId())
  1125.                     {
  1126.                         $players_from_account_in_guild[] = $player->getName();
  1127.                         if($player_rank->getLevel() > 1)
  1128.                         {
  1129.                             $guild_vice = TRUE;
  1130.                             $level_in_guild = $player_rank->getLevel();
  1131.                         }
  1132.                         if($guild->getOwner()->getId() == $player->getId())
  1133.                         {
  1134.                             $guild_vice = TRUE;
  1135.                             $guild_leader = TRUE;
  1136.                         }
  1137.                     }
  1138.         }
  1139.     }
  1140.     if(!$guild_vice)
  1141.         $guild_errors[] = 'You are not a leader or vice leader of guild ID <b>'.$guild_name.'</b>.';
  1142.     if($_REQUEST['invitation'] == 'yes')
  1143.     {
  1144.         if(!check_name($name))
  1145.             $guild_errors[] = 'Invalid name format.';
  1146.         if(empty($guild_errors))
  1147.         {
  1148.             $player = new Player();
  1149.             $player->find($name);
  1150.             if(!$player->isLoaded())
  1151.                 $guild_errors[] = 'Character <b>'.htmlspecialchars($name).'</b> doesn\'t exist.';
  1152.             else
  1153.             {
  1154.                 $rank_of_player = $player->getRank();
  1155.                 if(!empty($rank_of_player))
  1156.                     $guild_errors[] = 'Character <b>'.htmlspecialchars($name).'</b> is already in guild. He must leave guild before you can invite him.';
  1157.             }
  1158.         }
  1159.         if(empty($guild_errors))
  1160.         {
  1161.             $invited_list = $guild->listInvites();
  1162.             if(count($invited_list) > 0)
  1163.                 foreach($invited_list as $invited)
  1164.                     if($invited->getName() == $player->getName())
  1165.                         $guild_errors[] = '<b>'.htmlspecialchars($player->getName()).'</b> is already invited to your guild.';
  1166.         }
  1167.     }
  1168.     if($_REQUEST['invitation'] == 'no') {
  1169.         $player_remove_invite = $_REQUEST['character'];
  1170.         $player_noinvite = new Player();
  1171.         $player_noinvite->find($player_remove_invite);
  1172.         if($player_noinvite->isLoaded())
  1173.             $player_noinvite_id = $player_noinvite->getId();
  1174.  
  1175.     }
  1176.  
  1177.     if(!empty($guild_errors)) {
  1178.         $main_content .= '
  1179.             <div class="TableContainer" >
  1180.                 <table class="Table1" cellpadding="0" cellspacing="0" >
  1181.                     <div class="CaptionContainer" >
  1182.                         <div class="CaptionInnerContainer" >
  1183.                             <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1184.                             <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1185.                             <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1186.                             <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1187.                             <div class="Text" >Error</div>
  1188.                             <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1189.                             <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1190.                             <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1191.                             <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1192.                         </div>
  1193.                     </div>
  1194.                     <tr>
  1195.                         <td>
  1196.                             <div class="InnerTableContainer" >
  1197.                                 <table style="width:100%;" >
  1198.                                     <tr>
  1199.                                         <td class="red" >';
  1200.                                         foreach($guild_errors as $guild_error)
  1201.                                             $main_content .= '<p>'.$guild_error;
  1202.                                     $main_content .= '
  1203.                                         </td>
  1204.                                     </tr>
  1205.                                 </table>
  1206.                             </div>
  1207.                         </td>
  1208.                     </tr>
  1209.                 </table>
  1210.             </div><BR>';
  1211.     } else {
  1212.         if($_REQUEST['invitation'] == 'yes') {
  1213.             $guild->invite($player);
  1214.             //mensagem do char invitado
  1215.             $main_content .= '
  1216.                 <div class="TableContainer" >
  1217.                     <table class="Table1" cellpadding="0" cellspacing="0" >
  1218.                         <div class="CaptionContainer" >
  1219.                             <div class="CaptionInnerContainer" >
  1220.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1221.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1222.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1223.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1224.                                 <div class="Text" >Character Invited</div>
  1225.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1226.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1227.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1228.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1229.                             </div>
  1230.                         </div>
  1231.                         <tr>
  1232.                             <td><div class="InnerTableContainer" >
  1233.                                     <table style="width:100%;" >
  1234.                                         <tr>
  1235.                                             <td>'.htmlspecialchars($player->getName()).' has been invited.</td>
  1236.                                         </tr>
  1237.                                     </table>
  1238.                                 </div>
  1239.                             </td>
  1240.                         </tr>
  1241.                     </table>
  1242.                 </div>
  1243.                 <BR>';
  1244.         }
  1245.         if($_REQUEST['invitation'] == 'no') {
  1246.             $guild->deleteInvite($player_noinvite);
  1247.             $main_content .= '
  1248.                 <div class="TableContainer" >
  1249.                     <table class="Table1" cellpadding="0" cellspacing="0" >
  1250.                         <div class="CaptionContainer" >
  1251.                             <div class="CaptionInnerContainer" >
  1252.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1253.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1254.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1255.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1256.                                 <div class="Text" >Invitation Cancelled</div>
  1257.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1258.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1259.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1260.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1261.                             </div>
  1262.                         </div>
  1263.                         <tr>
  1264.                             <td>
  1265.                                 <div class="InnerTableContainer" >
  1266.                                     <table style="width:100%;" >
  1267.                                         <tr>
  1268.                                             <td>The invitation of '.$player_remove_invite.' has been cancelled.</td>
  1269.                                         </tr>
  1270.                                     </table>
  1271.                                 </div>
  1272.                             </td>
  1273.                         </tr>
  1274.                     </table>
  1275.                 </div>
  1276.                 <BR>';
  1277.         }
  1278.     }
  1279.         $main_content .= '
  1280.             Enter the name of a character you want to invite to your guild and click on "Submit".<BR><BR>';
  1281.         $main_content .= '
  1282.             <div class="TableContainer" >
  1283.                 <table class="Table1" cellpadding="0" cellspacing="0" >
  1284.                     <div class="CaptionContainer" >
  1285.                         <div class="CaptionInnerContainer" >
  1286.                             <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1287.                             <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1288.                             <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1289.                             <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1290.                             <div class="Text" >Invite Character</div>
  1291.                             <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1292.                             <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1293.                             <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1294.                             <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1295.                         </div>
  1296.                     </div>
  1297.                     <tr>
  1298.                         <td>
  1299.                             <div class="InnerTableContainer" >
  1300.                                 <table style="width:100%;" >
  1301.                                     <TR>
  1302.                                         <TD BGCOLOR=#D4C0A1>
  1303.                                             <FORM ACTION="?subtopic=guilds" METHOD=post>
  1304.                                                 <TABLE BORDER=0 CELLPADDING=1>
  1305.                                                     <TR>
  1306.                                                         <TD>Name:</TD>
  1307.                                                         <TD><INPUT NAME="character" VALUE="" SIZE=30 MAXLENGTH=30></TD>
  1308.                                                         <TD WIDTH=100% ALIGN=right>
  1309.                                                             <table border="0" cellspacing="0" cellpadding="0" >
  1310.                                                                 <tr>
  1311.                                                                     <td style="border:0px;" >
  1312.                                                                         <input type="hidden" name=action value=invite >
  1313.                                                                         <input type="hidden" name=invitation value=yes >
  1314.                                                                         <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  1315.                                                                         <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  1316.                                                                             <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  1317.                                                                                 <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
  1318.                                                                             </div>
  1319.                                                                         </div>
  1320.                                                                     </td>
  1321.                                                                 </tr>
  1322.                                                             </table>
  1323.                                                         </TD>
  1324.                                                     </TR>
  1325.                                                 </TABLE>
  1326.                                             </form>
  1327.                                         </td>
  1328.                                     </tr>
  1329.                                 </table>
  1330.                             </div>
  1331.                         </td>
  1332.                     </tr>
  1333.                 </table>
  1334.             </div>';
  1335.         $invited_list = $guild->listInvites();
  1336.         if(count($invited_list) > 0) {
  1337.             $main_content .= '
  1338.                 <BR>
  1339.                 If you want to cancel an invitation, select the according character and click on "Submit".<BR><BR>
  1340.                 <div class="TableContainer" >
  1341.                     <table class="Table1" cellpadding="0" cellspacing="0" >
  1342.                         <div class="CaptionContainer" >
  1343.                             <div class="CaptionInnerContainer" >
  1344.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1345.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1346.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1347.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1348.                                 <div class="Text" >Cancel Invitation</div>
  1349.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1350.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1351.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1352.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1353.                             </div>
  1354.                         </div>
  1355.                         <tr>
  1356.                             <td>
  1357.                                 <div class="InnerTableContainer" >
  1358.                                     <table style="width:100%;" >
  1359.                                         <TR>
  1360.                                             <TD BGCOLOR=#D4C0A1>
  1361.                                                 <FORM ACTION="?subtopic=guilds" METHOD=post>
  1362.                                                     <TABLE BORDER=0 CELLPADDING=1>
  1363.                                                         <TR>
  1364.                                                             <TD>Name:</TD>
  1365.                                                             <TD>
  1366.                                                                 <SELECT NAME="character">';
  1367.                                                             foreach($invited_list as $invited)
  1368.                                                                 $main_content .= '
  1369.                                                                     <OPTION VALUE="'.$invited->getName().'">'.$invited->getName().'</OPTION>';
  1370.                                                             $main_content .= '
  1371.                                                                 </SELECT>
  1372.                                                             </TD>
  1373.                                                             <TD WIDTH=100% ALIGN=right>
  1374.                                                                 <table border="0" cellspacing="0" cellpadding="0" >
  1375.                                                                     <tr>
  1376.                                                                         <td style="border:0px;" >
  1377.                                                                             <input type="hidden" name=action value=invite >
  1378.                                                                             <input type="hidden" name=invitation value=no >
  1379.                                                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  1380.                                                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  1381.                                                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  1382.                                                                                     <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
  1383.                                                                                 </div>
  1384.                                                                             </div>
  1385.                                                                         </td>
  1386.                                                                     <tr>
  1387.                                                                 </table>
  1388.                                                             </TD>
  1389.                                                         </TR>
  1390.                                                     </TABLE>
  1391.                                                 </FORM>
  1392.                                             </TD>
  1393.                                         </TR>
  1394.                                     </table>
  1395.                                 </div>
  1396.                             </td>
  1397.                         </tr>
  1398.                     </table>
  1399.                 </div>';
  1400.         }
  1401.  
  1402.         $main_content .= '
  1403.             <BR>
  1404.             <TABLE BORDER=0 WIDTH=100%>
  1405.                 <TR>
  1406.                     <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
  1407.                             <form action="?subtopic=guilds&action=view" method="post" >
  1408.                                 <tr>
  1409.                                     <td style="border:0px;" >
  1410.                                         <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  1411.                                         <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  1412.                                             <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  1413.                                                 <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  1414.                                             </div>
  1415.                                         </div>
  1416.                                     </td>
  1417.                                 </tr>
  1418.                             </form>
  1419.                         </table>
  1420.                     </TD>
  1421.                 </TR>
  1422.             </TABLE>';
  1423. }
  1424. if($action == "leave") {
  1425.     //set rights in guild
  1426.     $guild_name = (string) $_REQUEST['GuildName'];
  1427.     $name = $_REQUEST['character'];
  1428.     if(!$logged)
  1429.         $guild_errors[] = 'You are not logged in. You can\'t leave guild.';
  1430.     if(empty($guild_errors))
  1431.     {
  1432.         $guild = new Guild();
  1433.         $guild->loadByName($guild_name);
  1434.         if(!$guild->isLoaded())
  1435.             $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
  1436.     }
  1437.  
  1438.     if(empty($guild_errors))
  1439.     {
  1440.         $guild_owner_id = $guild->getOwner()->getId();
  1441.         if($_REQUEST['leaveguild'] == 'yes')
  1442.         {
  1443.             if(!check_name($name))
  1444.                 $guild_errors[] = 'Invalid name format.';
  1445.             if(empty($guild_errors))
  1446.             {
  1447.                 $player = new Player();
  1448.                 $player->find($name);
  1449.                 if(!$player->isLoaded())
  1450.                     $guild_errors[] = 'Character <b>'.htmlspecialchars($name).'</b> doesn\'t exist.';
  1451.                 else
  1452.                     if($player->getAccount()->getId() != $account_logged->getId())
  1453.                         $guild_errors[] = 'Character <b>'.htmlspecialchars($name).'</b> isn\'t from your account!';
  1454.             }
  1455.             if(empty($guild_errors))
  1456.             {
  1457.                 $player_loaded_rank = $player->getRank();
  1458.                 if(!empty($player_loaded_rank) && $player_loaded_rank->isLoaded())
  1459.                 {
  1460.                     if($player_loaded_rank->getGuild()->getId() != $guild->getId())
  1461.                         $guild_errors[] = 'Character <b>'.htmlspecialchars($name).'</b> isn\'t from guild <b>'.htmlspecialchars($guild->getName()).'</b>.';
  1462.                 }
  1463.                 else
  1464.                     $guild_errors[] = 'Character <b>'.htmlspecialchars($name).'</b> isn\'t in any guild.';
  1465.             }
  1466.             if(empty($guild_errors))
  1467.                 if($guild_owner_id == $player->getId())
  1468.                     $guild_errors[] = 'You can\'t leave guild. You are an owner of guild.';
  1469.         }
  1470.         else
  1471.         {
  1472.             $account_players = $account_logged->getPlayers();
  1473.             foreach($account_players as $player_fac)
  1474.             {
  1475.                 $player_rank = $player_fac->getRank();
  1476.                 if(!empty($player_rank))
  1477.                     if($player_rank->getGuild()->getId() == $guild->getId())
  1478.                         if($guild_owner_id != $player_fac->getId())
  1479.                             $array_of_player_ig[] = $player_fac->getName();
  1480.             }
  1481.         }
  1482.     }
  1483.     if(!empty($guild_errors)) {
  1484.         $main_content .= '
  1485.             <div class="TableContainer" >
  1486.                 <table class="Table1" cellpadding="0" cellspacing="0" >
  1487.                     <div class="CaptionContainer" >
  1488.                         <div class="CaptionInnerContainer" >
  1489.                             <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1490.                             <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1491.                             <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1492.                             <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1493.                             <div class="Text" >Error</div>
  1494.                             <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1495.                             <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1496.                             <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1497.                             <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1498.                         </div>
  1499.                     </div>
  1500.                     <tr>
  1501.                         <td>
  1502.                             <div class="InnerTableContainer" >
  1503.                                 <table style="width:100%;" >
  1504.                                     <tr>
  1505.                                         <td class="red" >';
  1506.                                         foreach($guild_errors as $guild_error)
  1507.                                             $main_content .= '<p>'.$guild_error;
  1508.                                     $main_content .= '
  1509.                                         </td>
  1510.                                     </tr>
  1511.                                 </table>
  1512.                             </div>
  1513.                         </td>
  1514.                     </tr>
  1515.                 </table>
  1516.             </div><BR>';
  1517.     } else {
  1518.         if($_REQUEST['leaveguild'] == 'yes') {
  1519.             $player->setRank();
  1520.             $player->save();
  1521.             $main_content .= '
  1522.                 <div class="TableContainer" >
  1523.                     <table class="Table1" cellpadding="0" cellspacing="0" >
  1524.                         <div class="CaptionContainer" >
  1525.                             <div class="CaptionInnerContainer" >
  1526.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1527.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1528.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1529.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1530.                                 <div class="Text" >Guild Left</div>
  1531.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1532.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1533.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1534.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1535.                             </div>
  1536.                         </div>
  1537.                         <tr>
  1538.                             <td><div class="InnerTableContainer" >
  1539.                                     <table style="width:100%;" >
  1540.                                         <tr>
  1541.                                             <td>You have left the guild.</td>
  1542.                                         </tr>
  1543.                                     </table>
  1544.                                 </div>
  1545.                             </td>
  1546.                         </tr>
  1547.                     </table>
  1548.                 </div><BR>
  1549.                 <TABLE BORDER=0 WIDTH=100%>
  1550.                     <TR>
  1551.                         <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
  1552.                                 <form action="?subtopic=guilds&page=view" method="post" >
  1553.                                     <tr>
  1554.                                         <td style="border:0px;" >
  1555.                                             <input type="hidden" name=action value=view >
  1556.                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  1557.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  1558.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  1559.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  1560.                                                 </div>
  1561.                                             </div>
  1562.                                         </td>
  1563.                                     </tr>
  1564.                                 </form>
  1565.                             </table>
  1566.                         </TD>
  1567.                     </TR>
  1568.                 </TABLE>';
  1569.         } else {
  1570.             $main_content .= '
  1571.                 The following of your characters are members of this guild. If you want to leave, select a character and click on "Submit".<BR><BR>';
  1572.             $main_content .= '
  1573.                 <FORM ACTION="?subtopic=guilds" METHOD=post>
  1574.                     <div class="TableContainer" >
  1575.                         <table class="Table1" cellpadding="0" cellspacing="0" >
  1576.                             <div class="CaptionContainer" >
  1577.                                 <div class="CaptionInnerContainer" >
  1578.                                     <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1579.                                     <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1580.                                     <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1581.                                     <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1582.                                     <div class="Text" >Guild Members</div>
  1583.                                     <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1584.                                     <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1585.                                     <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1586.                                     <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1587.                                 </div>
  1588.                             </div>
  1589.                             <tr>
  1590.                                 <td><div class="InnerTableContainer" >
  1591.                                         <table style="width:100%;" >
  1592.                                             <TR>';
  1593.                                         if(count($array_of_player_ig) > 0) {
  1594.                                             $main_content .= '
  1595.                                                 <TD BGCOLOR=#D4C0A1>';
  1596.                                                 sort($array_of_player_ig);
  1597.                                                 foreach($array_of_player_ig as $player_to_leave)
  1598.                                                     $main_content .= '
  1599.                                                         <INPUT TYPE=radio NAME="character" VALUE="'.htmlspecialchars($player_to_leave).'" '.((count($array_of_player_ig) == 1) ? 'checked' : '').'>'.htmlspecialchars($player_to_leave).'<BR>';
  1600.                                             $main_content .= '</TD>';
  1601.                                         } else {
  1602.                                             $main_content .= '<TD BGCOLOR=#D4C0A1>Any of your characters can\'t leave guild.</TD>';
  1603.                                         }
  1604.                                         $main_content .= '
  1605.                                             </TR>
  1606.                                         </table>
  1607.                                     </div>
  1608.                                 </td>
  1609.                             </tr>
  1610.                         </table>
  1611.                     </div>
  1612.                     <BR>
  1613.                     <TABLE BORDER=0 WIDTH=100%>
  1614.                         <TR align="center">
  1615.                             <TD ALIGN=center>
  1616.                                 <table border="0" cellspacing="0" cellpadding="0" >
  1617.                                     <tr>
  1618.                                         <td style="border:0px;" >
  1619.                                             <input type="hidden" name=action value=leave >
  1620.                                             <input type="hidden" name="leaveguild" value="yes">
  1621.                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  1622.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  1623.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  1624.                                                     <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
  1625.                                                 </div>
  1626.                                             </div>
  1627.                                         </td>
  1628.                                     <tr>
  1629.                                 </form>
  1630.                             </table>
  1631.                         </TD>
  1632.                         <TD ALIGN=center>
  1633.                             <table border="0" cellspacing="0" cellpadding="0" >
  1634.                                 <form action="?subtopic=guilds&action=view" method="post" >
  1635.                                     <tr>
  1636.                                         <td style="border:0px;" >
  1637.                                             <input type="hidden" name=action value=view >
  1638.                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  1639.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  1640.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  1641.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  1642.                                                 </div>
  1643.                                             </div>
  1644.                                         </td>
  1645.                                     </tr>
  1646.                                 </form>
  1647.                             </table>
  1648.                         </TD>
  1649.                     </TR>
  1650.                 </TABLE>';
  1651.         }
  1652.     }
  1653. }
  1654. if($action == "join") {
  1655.     //set rights in guild
  1656.     $guild_name = (string) $_REQUEST['GuildName'];
  1657.     $name = $_REQUEST['character'];
  1658.     if(!$logged)
  1659.         $guild_errors[] = 'You are not logged in. You can\'t accept invitations.';
  1660.     if(empty($guild_errors))
  1661.     {
  1662.         $guild = new Guild();
  1663.         $guild->loadByName($guild_name);
  1664.         if(!$guild->isLoaded())
  1665.             $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
  1666.     }
  1667.  
  1668.     if($_REQUEST['joinguild'] == 'yes')
  1669.     {
  1670.         if(!check_name($name))
  1671.             $guild_errors[] = 'Invalid name format.';
  1672.         if(empty($guild_errors))
  1673.         {
  1674.             $player = new Player();
  1675.             $player->find($name);
  1676.             if(!$player->isLoaded())
  1677.             {
  1678.                 $guild_errors[] = 'Player with name <b>'.htmlspecialchars($name).'</b> doesn\'t exist.';
  1679.             }
  1680.             else
  1681.             {
  1682.                 $rank_of_player = $player->getRank();
  1683.                 if(!empty($rank_of_player))
  1684.                 {
  1685.                     $guild_errors[] = 'Character with name <b>'.htmlspecialchars($name).'</b> is already in guild. You must leave guild before you join other guild.';
  1686.                 }
  1687.             }
  1688.         }
  1689.     }
  1690.     if($_REQUEST['joinguild'] == 'yes')
  1691.     {
  1692.         if(empty($guild_errors))
  1693.         {
  1694.             $is_invited = FALSE;
  1695.             $invited_list = $guild->listInvites();
  1696.             if(count($invited_list) > 0)
  1697.             {
  1698.                 foreach($invited_list as $invited)
  1699.                 {
  1700.                     if($invited->getName() == $player->getName())
  1701.                     {
  1702.                         $is_invited = TRUE;
  1703.                     }
  1704.                 }
  1705.             }
  1706.             if(!$is_invited)
  1707.             {
  1708.                 $guild_errors[] = 'Character '.htmlspecialchars($player->getName()).' isn\'t invited to guild <b>'.htmlspecialchars($guild->getName()).'</b>.';
  1709.             }
  1710.         }
  1711.     } else
  1712.     {
  1713.         if(empty($guild_errors))
  1714.         {
  1715.             $acc_invited = FALSE;
  1716.             $account_players = $account_logged->getPlayers();
  1717.             $invited_list = $guild->listInvites();
  1718.             if(count($invited_list) > 0)
  1719.             {
  1720.                 foreach($invited_list as $invited)
  1721.                 {
  1722.                     foreach($account_players as $player_from_acc)
  1723.                     {
  1724.                         if($invited->getName() == $player_from_acc->getName())
  1725.                         {
  1726.                             $acc_invited = TRUE;
  1727.                             $list_of_invited_players[] = $player_from_acc->getName();
  1728.                         }
  1729.                     }
  1730.                 }
  1731.             }
  1732.         }
  1733.         if(!$acc_invited)
  1734.         {
  1735.             $guild_errors[] = 'Any character from your account isn\'t invited to <b>'.htmlspecialchars($guild->getName()).'</b>.';
  1736.         }
  1737.     }
  1738.     if(!empty($guild_errors)) {
  1739.         $main_content .= '
  1740.             <div class="TableContainer" >
  1741.                 <table class="Table1" cellpadding="0" cellspacing="0" >
  1742.                     <div class="CaptionContainer" >
  1743.                         <div class="CaptionInnerContainer" >
  1744.                             <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1745.                             <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1746.                             <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1747.                             <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1748.                             <div class="Text" >Error</div>
  1749.                             <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1750.                             <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1751.                             <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1752.                             <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1753.                         </div>
  1754.                     </div>
  1755.                     <tr>
  1756.                         <td>
  1757.                             <div class="InnerTableContainer" >
  1758.                                 <table style="width:100%;" >
  1759.                                     <tr>
  1760.                                         <td class="red" >';
  1761.                                         foreach($guild_errors as $guild_error)
  1762.                                             $main_content .= '<p>'.$guild_error;
  1763.                                     $main_content .= '
  1764.                                         </td>
  1765.                                     </tr>
  1766.                                 </table>
  1767.                             </div>
  1768.                         </td>
  1769.                     </tr>
  1770.                 </table>
  1771.             </div><BR>';
  1772.     }else
  1773.     {
  1774.         if($_REQUEST['joinguild'] == 'yes') {
  1775.             $guild->acceptInvite($player);
  1776.             $main_content .= '
  1777.                 <div class="TableContainer" >
  1778.                     <table class="Table1" cellpadding="0" cellspacing="0" >
  1779.                         <div class="CaptionContainer" >
  1780.                             <div class="CaptionInnerContainer" >
  1781.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1782.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1783.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1784.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1785.                                 <div class="Text" >Guild Join</div>
  1786.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1787.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1788.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1789.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1790.                             </div>
  1791.                         </div>
  1792.                         <tr>
  1793.                             <td><div class="InnerTableContainer" >
  1794.                                     <table style="width:100%;" >
  1795.                                         <tr>
  1796.                                             <td>You have joined the guild.</td>
  1797.                                         </tr>
  1798.                                     </table>
  1799.                                 </div>
  1800.                             </td>
  1801.                         </tr>
  1802.                     </table>
  1803.                 </div><BR>
  1804.                 <TABLE BORDER=0 WIDTH=100%>
  1805.                     <TR>
  1806.                         <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
  1807.                                 <form action="?subtopic=guilds&action=view" method="post" >
  1808.                                     <tr>
  1809.                                         <td style="border:0px;" >
  1810.                                             <input type="hidden" name=action value=view >
  1811.                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  1812.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  1813.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  1814.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  1815.                                                 </div>
  1816.                                             </div>
  1817.                                         </td>
  1818.                                     </tr>
  1819.                                 </form>
  1820.                             </table>
  1821.                         </TD>
  1822.                     </TR>
  1823.                 </TABLE>';
  1824.         } else {
  1825.             $main_content .= '
  1826.                 The following of your characters are invited for this guild. If you want to join, select a character and click on "Submit".<BR><BR>';
  1827.             $main_content .= '
  1828.                 <FORM ACTION="?subtopic=guilds" METHOD=post>
  1829.                     <div class="TableContainer" >
  1830.                         <table class="Table1" cellpadding="0" cellspacing="0" >
  1831.                             <div class="CaptionContainer" >
  1832.                                 <div class="CaptionInnerContainer" >
  1833.                                     <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1834.                                     <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1835.                                     <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1836.                                     <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1837.                                     <div class="Text" >Join Guild</div>
  1838.                                     <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1839.                                     <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1840.                                     <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1841.                                     <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1842.                                 </div>
  1843.                             </div>
  1844.                             <tr>
  1845.                                 <td><div class="InnerTableContainer" >
  1846.                                         <table style="width:100%;" >
  1847.                                             <TR>';
  1848.                                         if(count($list_of_invited_players) > 0) {
  1849.                                             $main_content .= '
  1850.                                                 <TD BGCOLOR=#D4C0A1>';
  1851.                                                 sort($list_of_invited_players);
  1852.                                                 foreach($list_of_invited_players as $invited_player_from_list)
  1853.                                                     $main_content .= '
  1854.                                                         <INPUT TYPE=radio NAME="character" VALUE="'.htmlspecialchars($invited_player_from_list).'" '.((count($list_of_invited_players) == 1) ? 'checked' : '').'>'.htmlspecialchars($invited_player_from_list).'<BR>';
  1855.                                             $main_content .= '</TD>';
  1856.                                         } else {
  1857.                                             $main_content .= '<TD BGCOLOR=#D4C0A1>Any of your characters can\'t join guild.</TD>';
  1858.                                         }
  1859.                                         $main_content .= '
  1860.                                             </TR>
  1861.                                         </table>
  1862.                                     </div>
  1863.                                 </td>
  1864.                             </tr>
  1865.                         </table>
  1866.                     </div>
  1867.                     <BR>
  1868.                     <TABLE BORDER=0 WIDTH=100%>
  1869.                         <TR align="center">
  1870.                             <TD ALIGN=center>
  1871.                                 <table border="0" cellspacing="0" cellpadding="0" >
  1872.                                     <tr>
  1873.                                         <td style="border:0px;" >
  1874.                                             <input type="hidden" name=action value=join >
  1875.                                             <input type="hidden" name="joinguild" value="yes">
  1876.                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  1877.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  1878.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  1879.                                                     <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
  1880.                                                 </div>
  1881.                                             </div>
  1882.                                         </td>
  1883.                                     <tr>
  1884.                                 </form>
  1885.                             </table>
  1886.                         </TD>
  1887.                         <TD ALIGN=center>
  1888.                             <table border="0" cellspacing="0" cellpadding="0" >
  1889.                                 <form action="?subtopic=guilds&action=view" method="post" >
  1890.                                     <tr>
  1891.                                         <td style="border:0px;" >
  1892.                                             <input type="hidden" name=action value=view >
  1893.                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  1894.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  1895.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  1896.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  1897.                                                 </div>
  1898.                                             </div>
  1899.                                         </td>
  1900.                                     </tr>
  1901.                                 </form>
  1902.                             </table>
  1903.                         </TD>
  1904.                     </TR>
  1905.                 </TABLE>';
  1906.         }
  1907.     }
  1908. }
  1909. if($action == "ranks") {
  1910.     //set rights in guild
  1911.     $guild_name = (string) $_REQUEST['GuildName'];
  1912.     $ranktorename = (int) $_REQUEST['ranktorename'];
  1913.     $new_rankname = (string) trim($_REQUEST['newrankname']);
  1914.     $rank_name = $_REQUEST['rank_name'];
  1915.     if(!$logged)
  1916.         $guild_errors[] = 'You are not logged in. You can\'t accept invitations.';
  1917.     if(empty($guild_errors)) {
  1918.         $guild = new Guild();
  1919.         $guild->loadByName($guild_name);
  1920.         if(!$guild->isLoaded())
  1921.             $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
  1922.     }
  1923.     if(empty($guild_errors)) {
  1924.         $guild_leader_char = $guild->getOwner();
  1925.         $rank_list = $guild->getGuildRanksList();
  1926.         $guild_leader = FALSE;
  1927.         $account_players = $account_logged->getPlayers();
  1928.         foreach($account_players as $player)
  1929.             if($guild_leader_char->getId() == $player->getId())
  1930.             {
  1931.                 $guild_leader = TRUE;
  1932.                 $level_in_guild = 3;
  1933.             }
  1934.         if(!$guild_leader)
  1935.             $guild_errors[] = 'You are not leader of the Guild.';
  1936.     }
  1937.     if($_REQUEST['changerankname'] == "yes") {
  1938.         $rank_rename = new GuildRank();
  1939.         $rank_rename->load($ranktorename);
  1940.         if(!$rank_rename->isLoaded())
  1941.             $guild_errors[] = 'This rank doesn\'t exist.';
  1942.         if(!check_rank_name($new_rankname))
  1943.             $guild_errors[] = 'Invalid rank name. Please use only a-Z, 0-9 and spaces.';
  1944.     }
  1945.  
  1946.     if($_REQUEST['add_rank'] == "yes")
  1947.         if(!check_rank_name($rank_name))
  1948.             $guild_errors[] = 'Invalid rank name format.';
  1949.  
  1950.     if(!empty($guild_errors)) {
  1951.         //errors
  1952.         $main_content .= '
  1953.             <div class="TableContainer" >
  1954.                 <table class="Table1" cellpadding="0" cellspacing="0" >
  1955.                     <div class="CaptionContainer" >
  1956.                         <div class="CaptionInnerContainer" >
  1957.                             <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1958.                             <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1959.                             <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1960.                             <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1961.                             <div class="Text" >Guild Rank Errors</div>
  1962.                             <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1963.                             <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1964.                             <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1965.                             <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1966.                         </div>
  1967.                     </div>
  1968.                     <tr>
  1969.                         <td>
  1970.                             <div class="InnerTableContainer" >
  1971.                                 <table style="width:100%;" >
  1972.                                     <tr>
  1973.                                         <td class="red" >';
  1974.                                         foreach($guild_errors as $guild_error)
  1975.                                             $main_content .= '<p>'.$guild_error;
  1976.                                     $main_content .= '
  1977.                                         </td>
  1978.                                     </tr>
  1979.                                 </table>
  1980.                             </div>
  1981.                         </td>
  1982.                     </tr>
  1983.                 </table>
  1984.             </div><BR>';
  1985.     } else {
  1986.         if($_REQUEST['changerankname'] == "yes") {
  1987.             //renamed
  1988.             $rank_rename->setName($new_rankname);
  1989.             $rank_rename->save();
  1990.             $main_content .= '
  1991.                 <div class="TableContainer" >
  1992.                     <table class="Table1" cellpadding="0" cellspacing="0" >
  1993.                         <div class="CaptionContainer" >
  1994.                             <div class="CaptionInnerContainer" >
  1995.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1996.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  1997.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  1998.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  1999.                                 <div class="Text" >Guild Rank</div>
  2000.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2001.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2002.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2003.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2004.                             </div>
  2005.                         </div>
  2006.                         <tr>
  2007.                             <td><div class="InnerTableContainer" >
  2008.                                     <table style="width:100%;" >
  2009.                                         <tr>
  2010.                                             <td>The name of the rank was changed successfully.</td>
  2011.                                         </tr>
  2012.                                     </table>
  2013.                                 </div>
  2014.                             </td>
  2015.                         </tr>
  2016.                     </table>
  2017.                 </div><BR>
  2018.                 <TABLE BORDER=0 WIDTH=100%>
  2019.                     <TR>
  2020.                         <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
  2021.                                 <form action="?subtopic=guilds&action=view" method="post" >
  2022.                                     <tr>
  2023.                                         <td style="border:0px;" >
  2024.                                             <input type="hidden" name=action value=view >
  2025.                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  2026.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  2027.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  2028.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  2029.                                                 </div>
  2030.                                             </div>
  2031.                                         </td>
  2032.                                     </tr>
  2033.                                 </form>
  2034.                             </table>
  2035.                         </TD>
  2036.                     </TR>
  2037.                 </TABLE>';
  2038.             } elseif($_REQUEST['add_rank'] == "yes") {
  2039.             $new_rank = new GuildRank();
  2040.             $new_rank->setGuild($guild);
  2041.             $new_rank->setLevel(1);
  2042.             $new_rank->setName($rank_name);
  2043.             $new_rank->save();
  2044.  
  2045.             $main_content .= '
  2046.                 <div class="TableContainer" >
  2047.                     <table class="Table1" cellpadding="0" cellspacing="0" >
  2048.                         <div class="CaptionContainer" >
  2049.                             <div class="CaptionInnerContainer" >
  2050.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2051.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2052.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2053.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2054.                                 <div class="Text" >Guild Rank</div>
  2055.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2056.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2057.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2058.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2059.                             </div>
  2060.                         </div>
  2061.                         <tr>
  2062.                             <td><div class="InnerTableContainer" >
  2063.                                     <table style="width:100%;" >
  2064.                                         <tr>
  2065.                                             <td>The rank was added to Guild.</td>
  2066.                                         </tr>
  2067.                                     </table>
  2068.                                 </div>
  2069.                             </td>
  2070.                         </tr>
  2071.                     </table>
  2072.                 </div><BR>
  2073.                 <TABLE BORDER=0 WIDTH=100%>
  2074.                     <TR>
  2075.                         <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
  2076.                                 <form action="?subtopic=guilds&action=view" method="post" >
  2077.                                     <tr>
  2078.                                         <td style="border:0px;" >
  2079.                                             <input type="hidden" name=action value=view >
  2080.                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  2081.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  2082.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  2083.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  2084.                                                 </div>
  2085.                                             </div>
  2086.                                         </td>
  2087.                                     </tr>
  2088.                                 </form>
  2089.                             </table>
  2090.                         </TD>
  2091.                     </TR>
  2092.                 </TABLE>';
  2093.         } else {
  2094.             $main_content .= '
  2095.                 To change the name of a rank, simply edit name in the corresponding field and confirm the change by clicking on "Submit".<BR>
  2096.                 <BR>
  2097.                 <div class="TableContainer" >
  2098.                     <table class="Table5" cellpadding="0" cellspacing="0" >
  2099.                         <div class="CaptionContainer" >
  2100.                             <div class="CaptionInnerContainer" >
  2101.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2102.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2103.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2104.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2105.                                 <div class="Text" >Edit Guild Ranks</div>
  2106.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2107.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2108.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2109.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2110.                             </div>
  2111.                         </div>
  2112.                         <tr>
  2113.                             <td>
  2114.                                 <div class="InnerTableContainer" >
  2115.                                     <table style="width:100%;" >
  2116.                                         <tr>
  2117.                                             <td>
  2118.                                                 <div class="TableShadowContainerRightTop" >
  2119.                                                     <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rt.gif);" ></div>
  2120.                                                 </div>
  2121.                                                 <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rm.gif);" >
  2122.                                                     <div class="TableContentContainer" >
  2123.                                                         <table class="TableContent" width="100%" >
  2124.                                                             <TR>
  2125.                                                                 <TD BGCOLOR=#D4C0A1>
  2126.                                                                     <TABLE BORDER=0 CELLPADDING=2>
  2127.                                                                         <FORM ACTION="?subtopic=guilds" METHOD=post>
  2128.                                                                             <TR>
  2129.                                                                                 <TD>Set&nbsp;rank&nbsp;name</TD>
  2130.                                                                                 <TD>
  2131.                                                                                     <SELECT NAME="ranktorename">';
  2132.                                                                                 $rank_number = 0;
  2133.                                                                                 foreach($rank_list as $rank) {
  2134.                                                                                     $rank_number++;
  2135.                                                                                     $main_content .= '
  2136.                                                                                         <OPTION VALUE="'.$rank->getID().'">'.$rank_number.': '.$rank->getName().'</OPTION>';
  2137.                                                                                 }
  2138.                                                                                 $main_content .= '
  2139.                                                                                     </SELECT>
  2140.                                                                                 </TD>
  2141.                                                                                 <TD>to:</TD>
  2142.                                                                                 <TD><INPUT NAME="newrankname" VALUE="'.$_REQUEST['newrankname'].'" SIZE=30 MAXLENGTH=29></TD>
  2143.                                                                                 <TD WIDTH=100% ALIGN=right>
  2144.                                                                                     <table border="0" cellspacing="0" cellpadding="0" >
  2145.                                                                                         <tr>
  2146.                                                                                             <td style="border:0px;" >
  2147.                                                                                                 <input type="hidden" name=action value=ranks >
  2148.                                                                                                 <input type="hidden" name="changerankname" value="yes">
  2149.                                                                                                 <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  2150.                                                                                                 <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  2151.                                                                                                     <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
  2152.                                                                                                         <div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  2153.                                                                                                         <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
  2154.                                                                                                     </div>
  2155.                                                                                                 </div>
  2156.                                                                                             </td>
  2157.                                                                                         <tr>
  2158.                                                                                     </table>
  2159.                                                                                 </TD>
  2160.                                                                             </TR>
  2161.                                                                         </FORM>
  2162.                                                                     </TABLE>
  2163.                                                                 </TD>
  2164.                                                             </TR>
  2165.                                                         </table>
  2166.                                                     </div>
  2167.                                                 </div>
  2168.                                                 <div class="TableShadowContainer" >
  2169.                                                     <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bm.gif);" >
  2170.                                                         <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bl.gif);" ></div>
  2171.                                                         <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-br.gif);" ></div>
  2172.                                                     </div>
  2173.                                                 </div>
  2174.                                             </td>
  2175.                                         </tr>
  2176.                                     </table>
  2177.                                 </div>
  2178.                             </td>
  2179.                         </tr>
  2180.                     </table>
  2181.                 </div>
  2182.                 <BR>
  2183.                 <div class="TableContainer" >
  2184.                     <table class="Table5" cellpadding="0" cellspacing="0" >
  2185.                         <div class="CaptionContainer" >
  2186.                             <div class="CaptionInnerContainer" >
  2187.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2188.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2189.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2190.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2191.                                 <div class="Text" >Add new rank</div>
  2192.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2193.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2194.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2195.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2196.                             </div>
  2197.                         </div>
  2198.                         <tr>
  2199.                             <td>
  2200.                                 <div class="InnerTableContainer" >
  2201.                                     <table style="width:100%;" >
  2202.                                         <tr>
  2203.                                             <td>
  2204.                                                 <div class="TableShadowContainerRightTop" >
  2205.                                                     <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rt.gif);" ></div>
  2206.                                                 </div>
  2207.                                                 <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rm.gif);" >
  2208.                                                     <div class="TableContentContainer" >
  2209.                                                         <table class="TableContent" width="100%">
  2210.                                                             <TR>
  2211.                                                                 <TD BGCOLOR=#D4C0A1>
  2212.                                                                 <FORM ACTION="?subtopic=guilds" METHOD=post>
  2213.                                                                     <TABLE BORDER=0 CELLPADDING=3>
  2214.                                                                         <tr>
  2215.                                                                             <td valign="middle">New rank name:</td>
  2216.                                                                             <td valign="middle">
  2217.                                                                                 <input type="text" name="rank_name" size="50" value="'.$_REQUEST['rank_name'].'">
  2218.                                                                             </td>
  2219.                                                                             <td valign="middle">
  2220.                                                                                     <input type="hidden" name=action value=ranks >
  2221.                                                                                     <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  2222.                                                                                     <input type="hidden" name="add_rank" value="yes">
  2223.                                                                                     <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  2224.                                                                                         <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
  2225.                                                                                             <div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  2226.                                                                                             <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
  2227.                                                                                         </div>
  2228.                                                                                     </div>
  2229.                                                                                 </FORM>
  2230.                                                                             </td>
  2231.                                                                         </tr>
  2232.                                                                     </TABLE>
  2233.                                                                 </TD>
  2234.                                                             </TR>
  2235.                                                         </table>
  2236.                                                     </div>
  2237.                                                 </div>
  2238.                                                 <div class="TableShadowContainer" >
  2239.                                                     <div class="TableBottomShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bm.gif);" >
  2240.                                                         <div class="TableBottomLeftShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-bl.gif);" ></div>
  2241.                                                         <div class="TableBottomRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-br.gif);" ></div>
  2242.                                                     </div>
  2243.                                                 </div>
  2244.                                             </td>
  2245.                                         </tr>
  2246.                                     </table>
  2247.                                 </div>
  2248.                             </table>
  2249.                         </div>
  2250.                     </td>
  2251.                 </tr>
  2252.                 <br>
  2253.                 <TABLE BORDER=0 WIDTH=100%>
  2254.                     <TR>
  2255.                         <TD ALIGN=center>
  2256.                             <table border="0" cellspacing="0" cellpadding="0" >
  2257.                                 <form action="?subtopic=guilds&action=view" method="post" >
  2258.                                     <tr>
  2259.                                         <td style="border:0px;" >
  2260.                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  2261.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  2262.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  2263.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  2264.                                                 </div>
  2265.                                             </div>
  2266.                                         </td>
  2267.                                     </tr>
  2268.                                 </form>
  2269.                             </table>
  2270.                         </TD>
  2271.                     </TR>
  2272.                 </TABLE>';
  2273.         }
  2274.     }
  2275. }
  2276.  
  2277. #organize ranks
  2278.  
  2279. if($action == "members") {
  2280.  
  2281.     #infos
  2282.     $guild_name = (string) $_REQUEST['GuildName'];
  2283.     $player_name = $_REQUEST['character'];
  2284.     $new_rank = (int) $_REQUEST['newrank'];
  2285.     $newtitle = trim($_REQUEST['newtitle']);
  2286.  
  2287.     if(!$logged)
  2288.         $guild_errors[] = 'You are not logged in. You can\'t change rank.';
  2289.  
  2290.     if(empty($guild_errors)) {
  2291.         $guild = new Guild();
  2292.         $guild->loadByName($guild_name);
  2293.         if(!$guild->isLoaded())
  2294.             $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
  2295.     }
  2296.  
  2297.     if(empty($guild_errors)) {
  2298.         if($_REQUEST['promote'] == "yes")
  2299.             if(!isset($_REQUEST['function']) || $_REQUEST['function'] == "")
  2300.                 $guild_errors[] = 'Select an action.';
  2301.     }
  2302.  
  2303.     if(empty($guild_errors)) {
  2304.         $rank_list = $guild->getGuildRanksList();
  2305.         $guild_leader = FALSE;
  2306.         $guild_vice = FALSE;
  2307.         $account_players = $account_logged->getPlayers();
  2308.         foreach($account_players as $player)
  2309.         {
  2310.             $player_rank = $player->getRank();
  2311.             if(!empty($player_rank))
  2312.                 foreach($rank_list as $rank_in_guild)
  2313.                     if($rank_in_guild->getId() == $player_rank->getId())
  2314.                     {
  2315.                         $players_from_account_in_guild[] = $player->getName();
  2316.                         if($player_rank->getLevel() > 1) {
  2317.                             $guild_vice = TRUE;
  2318.                             $level_in_guild = $player_rank->getLevel();
  2319.                         }
  2320.                         if($guild->getOwner()->getId() == $player->getId()) {
  2321.                             $guild_vice = TRUE;
  2322.                             $guild_leader = TRUE;
  2323.                         }
  2324.                     }
  2325.         }
  2326.  
  2327.         //if(!$guild_vice)
  2328.             //$guild_errors[] = 'You are not leader or vice leader in the Guild.';
  2329.     }
  2330.  
  2331.     if(empty($guild_errors)) {
  2332.         foreach($rank_list as $rank)
  2333.         {
  2334.             if($guild_leader || $rank->getLevel() < $level_in_guild)
  2335.             {
  2336.                 $ranks[$rid]['0'] = $rank->getId();
  2337.                 $ranks[$rid]['1'] = $rank->getName();
  2338.                 $rid++;
  2339.                 $players_with_rank = $rank->getPlayersList();
  2340.                 if(count($players_with_rank) > 0)
  2341.                 {
  2342.                     foreach($players_with_rank as $player)
  2343.                     {
  2344.                         if($guild->getOwner()->getId() != $player->getId() || $guild_leader)
  2345.                         {
  2346.                             $players_with_lower_rank[$sid]['0'] = htmlspecialchars($player->getName());
  2347.                             $players_with_lower_rank[$sid]['1'] = htmlspecialchars($player->getName()).' ('.htmlspecialchars($rank->getName()).')';
  2348.                             $sid++;
  2349.                         }
  2350.                     }
  2351.                 }
  2352.             }
  2353.         }
  2354.  
  2355.         if($_REQUEST['promote'] == 'yes') {
  2356.             $player_to_change = new Player();
  2357.             $player_to_change->find($player_name);
  2358.             if(!$player_to_change->isLoaded())
  2359.                 $guild_errors[] = 'Player with name '.htmlspecialchars($player_name).'</b> doesn\'t exist.';
  2360.         }
  2361.     }
  2362.  
  2363.     if(empty($guild_errors))
  2364.         if($_REQUEST['promote'] == 'yes') {
  2365.             if($_REQUEST['function'] == "setrank") {
  2366.                 $rank = new GuildRank();
  2367.                 $rank->load($new_rank);
  2368.                 if(!$rank->isLoaded())
  2369.                     $guild_errors[] = 'Rank with this ID doesn\'t exist.';
  2370.             }
  2371.             if($_REQUEST['function'] == "settile") {
  2372.                 if(strlen($newtitle) >= 30)
  2373.                     $guild_errors[] = 'Too long guild nick. Max. 30 chars, your: '.strlen($newtitle);
  2374.             }
  2375.             if($_REQUEST['function'] == "exclude") {
  2376.                 if($guild->getOwner()->getName() == $player_to_change->getName())
  2377.                     $guild_errors[] = 'It\'s not exclude guild owner!';
  2378.  
  2379.             }
  2380.         }
  2381.  
  2382.     if(!empty($guild_errors)) {
  2383.         //errors
  2384.         $main_content .= '
  2385.             <div class="TableContainer" >
  2386.                 <table class="Table1" cellpadding="0" cellspacing="0" >
  2387.                     <div class="CaptionContainer" >
  2388.                         <div class="CaptionInnerContainer" >
  2389.                             <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2390.                             <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2391.                             <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2392.                             <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2393.                             <div class="Text" >Members Errors</div>
  2394.                             <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2395.                             <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2396.                             <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2397.                             <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2398.                         </div>
  2399.                     </div>
  2400.                     <tr>
  2401.                         <td>
  2402.                             <div class="InnerTableContainer" >
  2403.                                 <table style="width:100%;" >
  2404.                                     <tr>
  2405.                                         <td>';
  2406.                                         foreach($guild_errors as $guild_error)
  2407.                                             $main_content .= '<p>'.$guild_error;
  2408.                                     $main_content .= '
  2409.                                         </td>
  2410.                                     </tr>
  2411.                                 </table>
  2412.                             </div>
  2413.                         </td>
  2414.                     </tr>
  2415.                 </table>
  2416.             </div><BR>
  2417.             <TABLE BORDER=0 WIDTH=100%>
  2418.                     <TR>
  2419.                         <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
  2420.                                 <form action="?subtopic=guilds&action=view" method="post" >
  2421.                                     <tr>
  2422.                                         <td style="border:0px;" >
  2423.                                             <input type="hidden" name=action value=members >
  2424.                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  2425.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  2426.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  2427.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  2428.                                                 </div>
  2429.                                             </div>
  2430.                                         </td>
  2431.                                     </tr>
  2432.                                 </form>
  2433.                             </table>
  2434.                         </TD>
  2435.                     </TR>
  2436.                 </TABLE>';
  2437.     } else {
  2438.         if($_REQUEST['promote'] == "yes") {
  2439.             if($_REQUEST['function'] == "setrank") {
  2440.                 $player_to_change->setRank($rank);
  2441.                 $player_to_change->save();
  2442.                 $main_content .= '
  2443.                     <div class="TableContainer" >
  2444.                         <table class="Table1" cellpadding="0" cellspacing="0" >
  2445.                             <div class="CaptionContainer" >
  2446.                                 <div class="CaptionInnerContainer" >
  2447.                                     <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2448.                                     <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2449.                                     <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2450.                                     <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2451.                                     <div class="Text" >Members</div>
  2452.                                     <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2453.                                     <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2454.                                     <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2455.                                     <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2456.                                 </div>
  2457.                             </div>
  2458.                             <tr>
  2459.                                 <td><div class="InnerTableContainer" >
  2460.                                         <table style="width:100%;" >
  2461.                                             <tr>
  2462.                                                 <td>Rank of player '.htmlspecialchars($player_to_change->getName()).' has been changed to '.htmlspecialchars($rank->getName()).'.</td>
  2463.                                             </tr>
  2464.                                         </table>
  2465.                                     </div>
  2466.                                 </td>
  2467.                             </tr>
  2468.                         </table>
  2469.                     </div><BR>
  2470.                     <TABLE BORDER=0 WIDTH=100%>
  2471.                         <TR>
  2472.                             <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
  2473.                                     <form action="?subtopic=guilds&action=view" method="post" >
  2474.                                         <tr>
  2475.                                             <td style="border:0px;" >
  2476.                                                 <input type="hidden" name=action value=view >
  2477.                                                 <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  2478.                                                 <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  2479.                                                     <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  2480.                                                         <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  2481.                                                     </div>
  2482.                                                 </div>
  2483.                                             </td>
  2484.                                         </tr>
  2485.                                     </form>
  2486.                                 </table>
  2487.                             </TD>
  2488.                         </TR>
  2489.                     </TABLE>';
  2490.                 unset($players_with_lower_rank);
  2491.                 unset($ranks);
  2492.                 $rid = 0;
  2493.                 $sid= 0;
  2494.                 foreach($rank_list as $rank)
  2495.                 {
  2496.                     if($guild_leader || $rank->getLevel() < $level_in_guild)
  2497.                     {
  2498.                         $ranks[$rid]['0'] = $rank->getId();
  2499.                         $ranks[$rid]['1'] = $rank->getName();
  2500.                         $rid++;
  2501.                         $players_with_rank = $rank->getPlayersList();
  2502.                         if(count($players_with_rank) > 0)
  2503.                         {
  2504.                             foreach($players_with_rank as $player)
  2505.                             {
  2506.                                 if($guild->getOwner()->getId() != $player->getId() || $guild_leader)
  2507.                                 {
  2508.                                     $players_with_lower_rank[$sid]['0'] = htmlspecialchars($player->getName());
  2509.                                     $players_with_lower_rank[$sid]['1'] = htmlspecialchars($player->getName()).' ('.htmlspecialchars($rank->getName()).')';
  2510.                                     $sid++;
  2511.                                 }
  2512.                             }
  2513.                         }
  2514.                     }
  2515.                 }
  2516.             }
  2517.             if($_REQUEST['function'] == "settitle") {
  2518.                 $player_to_change->setGuildNick($newtitle);
  2519.                 $player_to_change->save();
  2520.                 $main_content .= '
  2521.                     <div class="TableContainer" >
  2522.                         <table class="Table1" cellpadding="0" cellspacing="0" >
  2523.                             <div class="CaptionContainer" >
  2524.                                 <div class="CaptionInnerContainer" >
  2525.                                     <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2526.                                     <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2527.                                     <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2528.                                     <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2529.                                     <div class="Text" >Members</div>
  2530.                                     <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2531.                                     <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2532.                                     <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2533.                                     <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2534.                                 </div>
  2535.                             </div>
  2536.                             <tr>
  2537.                                 <td><div class="InnerTableContainer" >
  2538.                                         <table style="width:100%;" >
  2539.                                             <tr>
  2540.                                                 <td>Title of player '.htmlspecialchars($player_to_change->getName()).' has been changed.</td>
  2541.                                             </tr>
  2542.                                         </table>
  2543.                                     </div>
  2544.                                 </td>
  2545.                             </tr>
  2546.                         </table>
  2547.                     </div><BR>
  2548.                     <TABLE BORDER=0 WIDTH=100%>
  2549.                         <TR>
  2550.                             <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
  2551.                                     <form action="?subtopic=guilds&action=view" method="post" >
  2552.                                         <tr>
  2553.                                             <td style="border:0px;" >
  2554.                                                 <input type="hidden" name=action value=view >
  2555.                                                 <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  2556.                                                 <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  2557.                                                     <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  2558.                                                         <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  2559.                                                     </div>
  2560.                                                 </div>
  2561.                                             </td>
  2562.                                         </tr>
  2563.                                     </form>
  2564.                                 </table>
  2565.                             </TD>
  2566.                         </TR>
  2567.                     </TABLE>';
  2568.             }
  2569.             if($_REQUEST['function'] == "exclude") {
  2570.                 $player_to_change->setRank();
  2571.                 $player_to_change->save();
  2572.                 $main_content .= '
  2573.                     <div class="TableContainer" >
  2574.                         <table class="Table1" cellpadding="0" cellspacing="0" >
  2575.                             <div class="CaptionContainer" >
  2576.                                 <div class="CaptionInnerContainer" >
  2577.                                     <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2578.                                     <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2579.                                     <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2580.                                     <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2581.                                     <div class="Text" >Members</div>
  2582.                                     <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2583.                                     <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2584.                                     <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2585.                                     <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2586.                                 </div>
  2587.                             </div>
  2588.                             <tr>
  2589.                                 <td><div class="InnerTableContainer" >
  2590.                                         <table style="width:100%;" >
  2591.                                             <tr>
  2592.                                                 <td>Player with name '.htmlspecialchars($player->getName()).' has been excluded from your guild.</td>
  2593.                                             </tr>
  2594.                                         </table>
  2595.                                     </div>
  2596.                                 </td>
  2597.                             </tr>
  2598.                         </table>
  2599.                     </div><BR>
  2600.                     <TABLE BORDER=0 WIDTH=100%>
  2601.                         <TR>
  2602.                             <TD ALIGN=center>
  2603.                                 <table border="0" cellspacing="0" cellpadding="0" >
  2604.                                     <form action="?subtopic=guilds&action=view" method="post" >
  2605.                                         <tr>
  2606.                                             <td style="border:0px;" >
  2607.                                                 <input type="hidden" name=action value=view >
  2608.                                                 <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  2609.                                                 <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  2610.                                                     <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  2611.                                                         <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  2612.                                                     </div>
  2613.                                                 </div>
  2614.                                             </td>
  2615.                                         </tr>
  2616.                                     </form>
  2617.                                 </table>
  2618.                             </TD>
  2619.                         </TR>
  2620.                     </TABLE>';
  2621.             }
  2622.         } else {
  2623.             $main_content .= '
  2624.             Select a member and the action you want to perform, then click on "Submit".<BR><BR>
  2625.             <FORM ACTION="?subtopic=guilds" METHOD=post>
  2626.                 <div class="TableContainer" >
  2627.                     <table class="Table1" cellpadding="0" cellspacing="0" >
  2628.                         <div class="CaptionContainer" >
  2629.                             <div class="CaptionInnerContainer" >
  2630.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2631.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2632.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2633.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2634.                                 <div class="Text" >Edit Members</div>
  2635.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2636.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2637.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2638.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2639.                             </div>
  2640.                         </div>
  2641.                         <tr>
  2642.                             <td>
  2643.                                 <div class="InnerTableContainer" >
  2644.                                     <table style="width:100%;" >
  2645.                                         <TR>
  2646.                                             <TD BGCOLOR=#D4C0A1>
  2647.                                                 <TABLE BORDER=0 CELLPADDING=1>
  2648.                                                     <TR>
  2649.                                                         <TD VALIGN=top>
  2650.                                                             <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=1>
  2651.                                                                 <TR>
  2652.                                                                     <TD>Name:</TD>
  2653.                                                                     <TD>
  2654.                                                                         <SELECT NAME="character">';
  2655.                                                                     foreach($players_with_lower_rank as $player_to_list)
  2656.                                                                         $main_content .= '
  2657.                                                                             <option value="'.$player_to_list['0'].'">'.$player_to_list['1'].'</option>';
  2658.                                                                     $main_content .= '
  2659.                                                                         </SELECT>
  2660.                                                                     </TD>
  2661.                                                                 </TR>
  2662.                                                             </TABLE>
  2663.                                                         </TD>
  2664.                                                         <TD>&#160;&#160;&#160;</TD>
  2665.                                                         <TD VALIGN=top>
  2666.                                                             <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=1>
  2667.                                                                 <TR>
  2668.                                                                     <TD>Action:</TD>
  2669.                                                                     <TD><INPUT TYPE=radio NAME="function" VALUE="setrank" '.(($_REQUEST['function'] == "setrank") ? 'checked' : '').'>
  2670.                                                                         Set rank to
  2671.                                                                         <SELECT NAME="newrank">';
  2672.                                                                     foreach($ranks as $rank)
  2673.                                                                         $main_content .= '
  2674.                                                                             <option value="'.htmlspecialchars($rank['0']).'" '.(($_REQUEST['newrank'] == $rank['0'])).'>'.htmlspecialchars($rank['1']).'</option>';
  2675.                                                                     $main_content .= '
  2676.                                                                         </SELECT>
  2677.                                                                     </TD>
  2678.                                                                 </TR>';
  2679.                                                         if($guild_leader) {
  2680.                                                             $main_content .= '
  2681.                                                                 <TR>
  2682.                                                                     <TD></TD>
  2683.                                                                     <TD><INPUT TYPE=radio NAME="function" VALUE="settitle" '.(($_REQUEST['function'] == "settitle") ? 'checked' : '').'>
  2684.                                                                         Set title to
  2685.                                                                         <INPUT NAME="newtitle" SIZE=30 MAXLENGTH=29></TD>
  2686.                                                                 </TR>';
  2687.                                                             $main_content .= '
  2688.                                                                 <TR>
  2689.                                                                     <TD></TD>
  2690.                                                                     <TD><INPUT TYPE=radio NAME="function" VALUE="exclude" '.(($_REQUEST['function'] == "exclude") ? 'checked' : '').'>
  2691.                                                                         Exclude from guild </TD>
  2692.                                                                 </TR>';
  2693.                                                         }
  2694.                                                         $main_content .= '
  2695.                                                             </TABLE>
  2696.                                                         </TD>
  2697.                                                     </TR>
  2698.                                                 </TABLE>
  2699.                                             </TD>
  2700.                                         </TR>
  2701.                                     </table>
  2702.                                 </div>
  2703.                             </td>
  2704.                         </tr>
  2705.                     </table>
  2706.                 </div>
  2707.             <BR>
  2708.             <TABLE BORDER=0 WIDTH=100%>
  2709.                 <TR align="center">
  2710.                     <TD ALIGN=center>
  2711.                         <table border="0" cellspacing="0" cellpadding="0" >
  2712.                             <tr>
  2713.                                 <td style="border:0px;" >
  2714.                                     <input type="hidden" name=action value=members >
  2715.                                     <input type="hidden" name="promote" value="yes">
  2716.                                     <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  2717.                                     <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  2718.                                         <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  2719.                                             <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
  2720.                                         </div>
  2721.                                     </div>
  2722.                                 </td>
  2723.                             <tr>
  2724.                         </table>
  2725.                     </TD>
  2726.                     </FORM>
  2727.                     <TD ALIGN=center>
  2728.                         <table border="0" cellspacing="0" cellpadding="0" >
  2729.                             <form action="?subtopic=guilds&action=view" method="post" >
  2730.                                 <tr>
  2731.                                     <td style="border:0px;" >
  2732.                                         <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  2733.                                         <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  2734.                                             <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  2735.                                                 <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  2736.                                             </div>
  2737.                                         </div>
  2738.                                     </td>
  2739.                                 </tr>
  2740.                             </form>
  2741.                         </table>
  2742.                     </TD>
  2743.                 </TR>
  2744.             </TABLE>';
  2745.         }
  2746.     }
  2747.  
  2748.  
  2749.  
  2750. } #members condition
  2751.  
  2752. if($action == "disband") {
  2753.     $guild_name = (string) $_REQUEST['GuildName'];
  2754.     $password = (string) trim($_REQUEST['password']);
  2755.     if(!$logged)
  2756.         $guild_errors[] = 'You are not logged in. You can\'t disband this Guild.';
  2757.     if(empty($guild_errors)) {
  2758.         $guild = new Guild();
  2759.         $guild->loadByName($guild_name);
  2760.         if(!$guild->isLoaded())
  2761.             $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
  2762.     }
  2763.     if(empty($guild_errors)) {
  2764.         $guild_leader_char = $guild->getOwner();
  2765.             $rank_list = $guild->getGuildRanksList();
  2766.             $guild_leader = FALSE;
  2767.             $account_players = $account_logged->getPlayers();
  2768.             foreach($account_players as $player)
  2769.                 if($guild->getOwner()->getId() == $player->getId())
  2770.                 {
  2771.                     $guild_vice = TRUE;
  2772.                     $guild_leader = TRUE;
  2773.                     $level_in_guild = 3;
  2774.                 }
  2775.                 if(!$guild_leader)
  2776.                     $guild_errors[] = 'You are not leader of Guild.';
  2777.     }
  2778.     if(empty($guild_errors)) {
  2779.         if($_REQUEST['disband'] == "yes")
  2780.             if(!$account_logged->isValidPassword($password))
  2781.                 $guild_errors[] = 'Wrong password.';
  2782.     }
  2783.     if(!empty($guild_errors)) {
  2784.         //errors
  2785.         $main_content .= '
  2786.             <div class="TableContainer" >
  2787.                 <table class="Table1" cellpadding="0" cellspacing="0" >
  2788.                     <div class="CaptionContainer" >
  2789.                         <div class="CaptionInnerContainer" >
  2790.                             <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2791.                             <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2792.                             <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2793.                             <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2794.                             <div class="Text" >Error</div>
  2795.                             <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2796.                             <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2797.                             <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2798.                             <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2799.                         </div>
  2800.                     </div>
  2801.                     <tr>
  2802.                         <td>
  2803.                             <div class="InnerTableContainer" >
  2804.                                 <table style="width:100%;" >
  2805.                                     <tr>
  2806.                                         <td>';
  2807.                                         foreach($guild_errors as $guild_error)
  2808.                                             $main_content .= '<p>'.$guild_error;
  2809.                                     $main_content .= '
  2810.                                         </td>
  2811.                                     </tr>
  2812.                                 </table>
  2813.                             </div>
  2814.                         </td>
  2815.                     </tr>
  2816.                 </table>
  2817.             </div><BR>
  2818.             <TABLE BORDER=0 WIDTH=100%>
  2819.                         <TR>
  2820.                             <TD ALIGN=center>
  2821.                                 <table border="0" cellspacing="0" cellpadding="0" >
  2822.                                     <form action="?subtopic=guilds" method="post" >
  2823.                                         <input type="hidden" name="action" value="disband">
  2824.                                         <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'">
  2825.                                         <tr>
  2826.                                             <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  2827.                                                     <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  2828.                                                         <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  2829.                                                     </div>
  2830.                                                 </div>
  2831.                                             </td>
  2832.                                         </tr>
  2833.                                     </form>
  2834.                                 </table>
  2835.                             </TD>
  2836.                         </TR>
  2837.                     </TABLE>';
  2838.     } else {
  2839.             if($_REQUEST['disband'] == "yes") {
  2840.                 $guild->delete();
  2841.                 $main_content .= '
  2842.                     <div class="TableContainer" >
  2843.                         <table class="Table1" cellpadding="0" cellspacing="0" >
  2844.                             <div class="CaptionContainer" >
  2845.                                 <div class="CaptionInnerContainer" >
  2846.                                     <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2847.                                     <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2848.                                     <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2849.                                     <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2850.                                     <div class="Text" >Guild Disbanded</div>
  2851.                                     <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2852.                                     <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2853.                                     <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2854.                                     <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2855.                                 </div>
  2856.                             </div>
  2857.                             <tr>
  2858.                                 <td>
  2859.                                     <div class="InnerTableContainer" >
  2860.                                         <table style="width:100%;" >
  2861.                                             <tr>
  2862.                                                 <td>You have disbanded the '.$_REQUEST['GuildName'].'.</td>
  2863.                                             </tr>
  2864.                                         </table>
  2865.                                     </div>
  2866.                                 </td>
  2867.                             </tr>
  2868.                         </table>
  2869.                     </div><BR>
  2870.                     <TABLE BORDER=0 WIDTH=100%>
  2871.                         <TR>
  2872.                             <TD ALIGN=center>
  2873.                                 <table border="0" cellspacing="0" cellpadding="0" >
  2874.                                     <form action="?subtopic=guilds" method="post" >
  2875.                                         <tr>
  2876.                                             <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  2877.                                                     <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  2878.                                                         <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  2879.                                                     </div>
  2880.                                                 </div>
  2881.                                             </td>
  2882.                                         </tr>
  2883.                                     </form>
  2884.                                 </table>
  2885.                             </TD>
  2886.                         </TR>
  2887.                     </TABLE>';
  2888.             } else {
  2889.                 $main_content .= '
  2890.                     Do you really want to disband your guild? Confirm this decision with your password and click on "Submit".<BR>
  2891.                     <BR>
  2892.                     <FORM ACTION="?subtopic=guilds" METHOD=post>
  2893.                         <div class="TableContainer" >
  2894.                             <table class="Table1" cellpadding="0" cellspacing="0" >
  2895.                                 <div class="CaptionContainer" >
  2896.                                     <div class="CaptionInnerContainer" >
  2897.                                         <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2898.                                         <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2899.                                         <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2900.                                         <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2901.                                         <div class="Text" >Disband Guild</div>
  2902.                                         <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  2903.                                         <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  2904.                                         <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2905.                                         <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  2906.                                     </div>
  2907.                                 </div>
  2908.                                 <tr>
  2909.                                     <td>
  2910.                                         <div class="InnerTableContainer" >
  2911.                                             <table style="width:100%;" >
  2912.                                                 <TR>
  2913.                                                     <TD BGCOLOR=#D4C0A1><TABLE BORDER=0 CELLPADDING=1>
  2914.                                                             <TR>
  2915.                                                                 <TD>Password:</TD>
  2916.                                                                 <TD><INPUT TYPE=password NAME="password" SIZE=30 MAXLENGTH=29></TD>
  2917.                                                             </TR>
  2918.                                                         </TABLE>
  2919.                                                     </TD>
  2920.                                                 </TR>
  2921.                                             </table>
  2922.                                         </div>
  2923.                                     </td>
  2924.                                 </tr>
  2925.                             </table>
  2926.                         </div>
  2927.                         <BR>
  2928.                         <TABLE BORDER=0 WIDTH=100%>
  2929.                             <TR>
  2930.                                 <TD ALIGN=center><IMG SRC="'.$layout_name.'/images/global/general/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR></TD>
  2931.                                 <TD ALIGN=center><table border="0" cellspacing="0" cellpadding="0" >
  2932.                                     <tr>
  2933.                                         <td style="border:0px;" >
  2934.                                             <input type="hidden" name=action value=disband>
  2935.                                             <input type="hidden" name="disband" value="yes">
  2936.                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  2937.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  2938.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  2939.                                                     <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
  2940.                                                 </div>
  2941.                                             </div>
  2942.                                         </td>
  2943.                                     <tr>
  2944.                                 </form>
  2945.                             </table>
  2946.                         </TD>
  2947.                         <TD ALIGN=center>
  2948.                             <table border="0" cellspacing="0" cellpadding="0" >
  2949.                                 <form action="?subtopic=guilds&action=view" method="post" >
  2950.                                     <tr>
  2951.                                         <td style="border:0px;" >
  2952.                                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  2953.                                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  2954.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
  2955.                                                     <div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  2956.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  2957.                                                 </div>
  2958.                                             </div>
  2959.                                         </td>
  2960.                                     </tr>
  2961.                                 </form>
  2962.                             </table>
  2963.                         </TD>
  2964.                         <TD ALIGN=center><IMG SRC="'.$layout_name.'/images/global/general/blank.gif" WIDTH=120 HEIGHT=1 BORDER=0><BR></TD>
  2965.                     </TR>
  2966.                 </TABLE>';
  2967.             }
  2968.     }
  2969. }
  2970. if($action == "description") {
  2971.     $guild_name = (string) $_REQUEST['GuildName'];
  2972.     if(empty($guild_errors))
  2973.     {
  2974.         $guild = new Guild();
  2975.         $guild->loadByName($guild_name);
  2976.         if(!$guild->isLoaded())
  2977.             $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
  2978.     }
  2979.     if(empty($guild_errors)) {
  2980.         $guild_leader_char = $guild->getOwner();
  2981.         $rank_list = $guild->getGuildRanksList();
  2982.         $guild_leader = FALSE;
  2983.         $account_players = $account_logged->getPlayers();
  2984.         foreach($account_players as $player)
  2985.             if($guild->getOwner()->getId() == $player->getId()) {
  2986.                 $guild_vice = TRUE;
  2987.                 $guild_leader = TRUE;
  2988.                 $level_in_guild = 3;
  2989.             }
  2990.         if(!$guild_leader)
  2991.             $guild_errors[] = 'You are not the Guild Leader.';
  2992.     }
  2993.     if(empty($guild_errors)) {
  2994.         $max_image_size_b = $config['site']['guild_image_size_kb'] * 1024;
  2995.         if($_REQUEST['guildlogo'] == "yes") {
  2996.             $file = $_FILES['newlogo'];
  2997.         if(is_uploaded_file($file['tmp_name']))
  2998.             switch($file['error']) {
  2999.                 case UPLOAD_ERR_OK:
  3000.                     break; // all ok
  3001.                 case UPLOAD_ERR_INI_SIZE:
  3002.                 case UPLOAD_ERR_FORM_SIZE:
  3003.                     $guild_errors[] = 'Image is too large';
  3004.                     break;
  3005.                 case UPLOAD_ERR_PARTIAL:
  3006.                     $guild_errors[] = 'Image was only partially uploaded';
  3007.                     break;
  3008.                 case UPLOAD_ERR_NO_TMP_DIR:
  3009.                     $guild_errors[] = 'Upload folder not found';
  3010.                     break;
  3011.                 case UPLOAD_ERR_CANT_WRITE:
  3012.                     $guild_errors[] = 'Unable to write uploaded file';
  3013.                     break;
  3014.                 case UPLOAD_ERR_EXTENSION:
  3015.                     $guild_errors[] =  'Upload failed due to extension';
  3016.                     break;
  3017.                 default:
  3018.                     $guild_errors[] =  'Unknown error';
  3019.             }
  3020.             if(is_uploaded_file($file['tmp_name'])) {
  3021.                 if($file['size'] > $max_image_size_b)
  3022.                     $guild_errors[] = 'Uploaded image is too big. Size: <b>'.$file['size'].' bytes</b>, Max. size: <b>'.$max_image_size_b.' bytes</b>.';
  3023.                 $info = getimagesize($file['tmp_name']);
  3024.                 if(!$info)
  3025.                     $guild_errors[] = 'Uploaded file is not an image!';
  3026.             }
  3027.         }
  3028.     }
  3029.     if(!empty($guild_errors)) {
  3030.         if($_REQUEST['changedescription'] == "yes") {
  3031.             //errors
  3032.             $main_content .= '
  3033.                 <div class="TableContainer" >
  3034.                     <table class="Table1" cellpadding="0" cellspacing="0" >
  3035.                         <div class="CaptionContainer" >
  3036.                             <div class="CaptionInnerContainer" >
  3037.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3038.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3039.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3040.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3041.                                 <div class="Text" >Guild Description Error</div>
  3042.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3043.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3044.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3045.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3046.                             </div>
  3047.                         </div>
  3048.                         <tr>
  3049.                             <td>
  3050.                                 <div class="InnerTableContainer" >
  3051.                                     <table style="width:100%;" >
  3052.                                         <tr>
  3053.                                             <td>';
  3054.                                             foreach($guild_errors as $guild_error)
  3055.                                                 $main_content .= '<p>'.$guild_error;
  3056.                                         $main_content .= '
  3057.                                             </td>
  3058.                                         </tr>
  3059.                                     </table>
  3060.                                 </div>
  3061.                             </td>
  3062.                         </tr>
  3063.                     </table>
  3064.                 </div><BR>
  3065.                 <TABLE BORDER=0 WIDTH=100%>
  3066.                     <TR>
  3067.                         <TD ALIGN=center>
  3068.                             <table border="0" cellspacing="0" cellpadding="0" >
  3069.                                 <form action="?subtopic=guilds" method="post" >
  3070.                                     <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'">
  3071.                                     <tr>
  3072.                                         <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  3073.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  3074.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  3075.                                                 </div>
  3076.                                             </div>
  3077.                                         </td>
  3078.                                     </tr>
  3079.                                 </form>
  3080.                             </table>
  3081.                         </TD>
  3082.                     </TR>
  3083.                 </TABLE>';
  3084.         }
  3085.         if($_REQUEST['guildlogo'] == "yes") {
  3086.             //errors
  3087.             $main_content .= '
  3088.                 <div class="TableContainer" >
  3089.                     <table class="Table1" cellpadding="0" cellspacing="0" >
  3090.                         <div class="CaptionContainer" >
  3091.                             <div class="CaptionInnerContainer" >
  3092.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3093.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3094.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3095.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3096.                                 <div class="Text" >Guild Logo Error</div>
  3097.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3098.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3099.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3100.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3101.                             </div>
  3102.                         </div>
  3103.                         <tr>
  3104.                             <td>
  3105.                                 <div class="InnerTableContainer" >
  3106.                                     <table style="width:100%;" >
  3107.                                         <tr>
  3108.                                             <td>';
  3109.                                             foreach($guild_errors as $guild_error)
  3110.                                                 $main_content .= '<p>'.$guild_error;
  3111.                                         $main_content .= '
  3112.                                             </td>
  3113.                                         </tr>
  3114.                                     </table>
  3115.                                 </div>
  3116.                             </td>
  3117.                         </tr>
  3118.                     </table>
  3119.                 </div><BR>
  3120.                 <TABLE BORDER=0 WIDTH=100%>
  3121.                     <TR>
  3122.                         <TD ALIGN=center>
  3123.                             <table border="0" cellspacing="0" cellpadding="0" >
  3124.                                 <form action="?subtopic=guilds" method="post" >
  3125.                                     <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'">
  3126.                                     <tr>
  3127.                                         <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  3128.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  3129.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  3130.                                                 </div>
  3131.                                             </div>
  3132.                                         </td>
  3133.                                     </tr>
  3134.                                 </form>
  3135.                             </table>
  3136.                         </TD>
  3137.                     </TR>
  3138.                 </TABLE>';
  3139.         }
  3140.     } else {
  3141.         if($_REQUEST['changedescription'] == "yes") {
  3142.             $description = htmlspecialchars(substr(trim($_REQUEST['description']),0,$config['site']['guild_description_chars_limit']));
  3143.             $guild->set('description', $description);
  3144.             $guild->save();
  3145.             $main_content .= '
  3146.                 <div class="TableContainer" >
  3147.                     <table class="Table1" cellpadding="0" cellspacing="0" >
  3148.                         <div class="CaptionContainer" >
  3149.                             <div class="CaptionInnerContainer" >
  3150.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3151.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3152.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3153.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3154.                                 <div class="Text" >Guild Description Changed</div>
  3155.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3156.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3157.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3158.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3159.                             </div>
  3160.                         </div>
  3161.                         <tr>
  3162.                             <td>
  3163.                                 <div class="InnerTableContainer" >
  3164.                                     <table style="width:100%;" >
  3165.                                         <tr>
  3166.                                             <td>Your Guild Description was changed succefully.</td>
  3167.                                         </tr>
  3168.                                     </table>
  3169.                                 </div>
  3170.                             </td>
  3171.                         </tr>
  3172.                     </table>
  3173.                 </div><BR>
  3174.                 <TABLE BORDER=0 WIDTH=100%>
  3175.                     <TR>
  3176.                         <TD ALIGN=center>
  3177.                             <table border="0" cellspacing="0" cellpadding="0" >
  3178.                                 <form action="?subtopic=guilds" method="post" >
  3179.                                     <input type="hidden" name="action" value="view">
  3180.                                     <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'">
  3181.                                     <tr>
  3182.                                         <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  3183.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  3184.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  3185.                                                 </div>
  3186.                                             </div>
  3187.                                         </td>
  3188.                                     </tr>
  3189.                                 </form>
  3190.                             </table>
  3191.                         </TD>
  3192.                     </TR>
  3193.                 </TABLE>';
  3194.         }
  3195.         elseif($_REQUEST['guildlogo'] == "yes") {
  3196.             if(!is_uploaded_file($file['tmp_name'])) {
  3197.                 $guild->setGuildLogo('image/gif', Website::getFileContents('./images/default_guild_logo.gif'));
  3198.                 $guild->save();
  3199.             } else {
  3200.                 $guild->setGuildLogo($info['mime'], file_get_contents($file['tmp_name']));
  3201.                 $guild->save();
  3202.             }
  3203.             $main_content .= '
  3204.                 <div class="TableContainer" >
  3205.                     <table class="Table1" cellpadding="0" cellspacing="0" >
  3206.                         <div class="CaptionContainer" >
  3207.                             <div class="CaptionInnerContainer" >
  3208.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3209.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3210.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3211.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3212.                                 <div class="Text" >Guild Logo Changed</div>
  3213.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3214.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3215.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3216.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3217.                             </div>
  3218.                         </div>
  3219.                         <tr>
  3220.                             <td>
  3221.                                 <div class="InnerTableContainer" >
  3222.                                     <table style="width:100%;" >
  3223.                                         <tr>
  3224.                                             <td>Your Guild Logo was changed succefully.</td>
  3225.                                         </tr>
  3226.                                     </table>
  3227.                                 </div>
  3228.                             </td>
  3229.                         </tr>
  3230.                     </table>
  3231.                 </div><BR>
  3232.                 <TABLE BORDER=0 WIDTH=100%>
  3233.                     <TR>
  3234.                         <TD ALIGN=center>
  3235.                             <table border="0" cellspacing="0" cellpadding="0" >
  3236.                                 <form action="?subtopic=guilds" method="post" >
  3237.                                     <input type="hidden" name="action" value="view">
  3238.                                     <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'">
  3239.                                     <tr>
  3240.                                         <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  3241.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  3242.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  3243.                                                 </div>
  3244.                                             </div>
  3245.                                         </td>
  3246.                                     </tr>
  3247.                                 </form>
  3248.                             </table>
  3249.                         </TD>
  3250.                     </TR>
  3251.                 </TABLE>';
  3252.         }
  3253.         else {
  3254.                 $main_content .= 'If you want to change the description or the URL of the official homepage of your guild, edit the corresponding field and click on the "Submit" button.<BR><BR>';
  3255.     //formulario com as ações
  3256.     $main_content .= '
  3257.         <FORM ACTION="?subtopic=guilds" METHOD=post>
  3258.             <div class="TableContainer" >
  3259.                 <table class="Table1" cellpadding="0" cellspacing="0" >
  3260.                     <div class="CaptionContainer" >
  3261.                         <div class="CaptionInnerContainer" >
  3262.                             <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3263.                             <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3264.                             <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3265.                             <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3266.                             <div class="Text" >Change Description</div>
  3267.                             <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3268.                             <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3269.                             <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3270.                             <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3271.                         </div>
  3272.                     </div>
  3273.                     <tr>
  3274.                         <td>
  3275.                             <div class="InnerTableContainer" >
  3276.                                 <table style="width:100%;" >
  3277.                                     <tr>
  3278.                                         <td valign="top">Description:</td>
  3279.                                         <td><textarea name="description" cols="60" rows="15">'.$guild->getDescription().'</textarea></td>
  3280.                                         <td align="right" valign="bottom">
  3281.                                             <table border="0" cellspacing="0" cellpadding="0" >
  3282.                                                 <tr>
  3283.                                                     <td style="border:0px;" >
  3284.                                                         <input type="hidden" name="changedescription" value="yes">
  3285.                                                         <input type="hidden" name="action" value="description">
  3286.                                                         <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  3287.                                                         <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  3288.                                                             <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  3289.                                                                 <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
  3290.                                                             </div>
  3291.                                                         </div>
  3292.                                                     </td>
  3293.                                                 </tr>
  3294.                                                 </form>
  3295.                                             </table>
  3296.                                         </td>
  3297.                                     </tr>
  3298.                                 </table>
  3299.                             </div>
  3300.                         </td>
  3301.                     </tr>
  3302.                 </table>
  3303.             </div><BR>
  3304.             If you want to change the logo of your guild, enter the path to a 64*64 pixels GIF icon and click on the "Submit" button.<BR>Leave the path empty if you want to use the default logo.<BR><BR>
  3305.             <FORM ACTION="?subtopic=guilds" METHOD=post enctype="multipart/form-data">
  3306.             <div class="TableContainer" >
  3307.                 <table class="Table1" cellpadding="0" cellspacing="0" >
  3308.                     <div class="CaptionContainer" >
  3309.                         <div class="CaptionInnerContainer" >
  3310.                             <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3311.                             <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3312.                             <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3313.                             <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3314.                             <div class="Text" >Guild Logo</div>
  3315.                             <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3316.                             <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3317.                             <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3318.                             <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3319.                         </div>
  3320.                     </div>
  3321.                     <tr>
  3322.                         <td>
  3323.                             <div class="InnerTableContainer" >
  3324.                                 <table style="width:100%;" >
  3325.                                     <tr>
  3326.                                         <td valign="top">Current logo:</td>
  3327.                                         <td><IMG SRC="'. $guild->getGuildLogoLink() .'" WIDTH=64 HEIGHT=64></td>
  3328.                                         <td></td>
  3329.                                     </tr>
  3330.                                     <tr>
  3331.                                         <td valign="top">New logo:</td>
  3332.                                         <td><input type="file" name="newlogo"></td>
  3333.                                         <td align="right">
  3334.                                             <table border="0" cellspacing="0" cellpadding="0" >
  3335.                                                 <tr>
  3336.                                                     <td style="border:0px;" >
  3337.                                                         <input type="hidden" name="guildlogo" value="yes">
  3338.                                                         <input type="hidden" name="action" value="description">
  3339.                                                         <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  3340.                                                         <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  3341.                                                             <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  3342.                                                                 <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
  3343.                                                             </div>
  3344.                                                         </div>
  3345.                                                     </td>
  3346.                                                 </tr>
  3347.                                                 </form>
  3348.                                             </table>
  3349.                                         </td>
  3350.                                     </tr>
  3351.                                 </table>
  3352.                             </div>
  3353.                         </td>
  3354.                     </tr>
  3355.                 </table>
  3356.             </div><BR>
  3357.             <TABLE BORDER=0 WIDTH=100%>
  3358.                 <TR align="center">
  3359.                     <TD ALIGN=center>
  3360.                         <table border="0" cellspacing="0" cellpadding="0" >
  3361.                             <form action="?subtopic=guilds&action=view" method="post" >
  3362.                                 <tr>
  3363.                                     <td style="border:0px;" >
  3364.                                         <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  3365.                                         <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  3366.                                             <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  3367.                                                 <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  3368.                                             </div>
  3369.                                         </div>
  3370.                                     </td>
  3371.                                 </tr>
  3372.                             </form>
  3373.                         </table>
  3374.                     </TD>
  3375.                 </TR>
  3376.             </TABLE>';
  3377.         }
  3378.     }
  3379. }
  3380. if($action == "resignleadership") {
  3381.     $guild_name = (string) $_REQUEST['GuildName'];
  3382.     $pass_to = (string) $_REQUEST['character'];
  3383.     $password = trim($_REQUEST['password']);
  3384.     if(empty($guild_errors))
  3385.     {
  3386.         $guild = new Guild();
  3387.         $guild->loadByName($guild_name);
  3388.         if(!$guild->isLoaded())
  3389.             $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
  3390.     }
  3391.     if(empty($guild_errors))
  3392.     {
  3393.         if($_POST['resign'] == 'yes')
  3394.         {
  3395.             if(!$account_logged->isValidPassword($password))
  3396.                 $guild_errors[] = 'Password is wrong.';
  3397.             if(!check_name($pass_to))
  3398.                 $guild_errors[] = 'Invalid player name format.';
  3399.             if(empty($guild_errors))
  3400.             {
  3401.                 $to_player = new Player();
  3402.                 $to_player->find($pass_to);
  3403.                 if(!$to_player->isLoaded())
  3404.                     $guild_errors[] = 'Player with name <b>'.htmlspecialchars($pass_to).'</b> doesn\'t exist.';
  3405.                 if(empty($guild_errors))
  3406.                 {
  3407.                     $to_player_rank = $to_player->getRank();
  3408.                     if(!empty($to_player_rank))
  3409.                     {
  3410.                         $to_player_guild = $to_player_rank->getGuild();
  3411.                         if($to_player_guild->getId() != $guild->getId())
  3412.                             $guild_errors[] = 'Player with name <b>'.htmlspecialchars($to_player->getName()).'</b> isn\'t from your guild.';
  3413.                     }
  3414.                     else
  3415.                         $guild_errors[] = 'Player with name <b>'.htmlspecialchars($to_player->getName()).'</b> isn\'t from your guild.';
  3416.                 }
  3417.             }
  3418.         }
  3419.     }
  3420.     if(empty($guild_errors)) {
  3421.         if($logged) {
  3422.             $guild_leader_char = $guild->getOwner();
  3423.             $guild_leader = FALSE;
  3424.             $account_players = $account_logged->getPlayers();
  3425.             foreach($account_players as $player)
  3426.                 if($guild_leader_char->getId() == $player->getId()) {
  3427.                     $guild_vice = TRUE;
  3428.                     $guild_leader = TRUE;
  3429.                     $level_in_guild = 3;
  3430.                 }
  3431.             if($guild_leader) {
  3432.                 if($_POST['resign'] == 'yes') {
  3433.                     $newleaderID = $to_player->getID();
  3434.                     $oldleaderID = $guild_leader_char->getId();
  3435.                     $newrank = $guild_leader_char->getRank()->getID();
  3436.                     $oldrank = $to_player_rank->getID();
  3437.                     $up = filter_var($up, FILTER_SANITIZE_STRING);
  3438.                     $up = $SQL->query("UPDATE `guild_membership` SET `rank_id` = '$newrank' WHERE `player_id` = '$newleaderID'");
  3439.                     if($up)
  3440.                         $up2 = filter_var($up2, FILTER_SANITIZE_STRING);
  3441.                         $up2 = $SQL->query("UPDATE `guild_membership` SET `rank_id` = '$oldrank' WHERE `player_id` = '$oldleaderID'");
  3442.                     if($up2) {
  3443.                         $guild->setOwner($to_player);
  3444.                         $guild->save();
  3445.                     }
  3446.                     $saved = TRUE;
  3447.  
  3448.                     $main_content .= '
  3449.                         <div class="TableContainer" >
  3450.                             <table class="Table1" cellpadding="0" cellspacing="0" >
  3451.                                 <div class="CaptionContainer" >
  3452.                                     <div class="CaptionInnerContainer" >
  3453.                                         <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3454.                                         <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3455.                                         <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3456.                                         <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3457.                                         <div class="Text" >New Guild Leadership</div>
  3458.                                         <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3459.                                         <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3460.                                         <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3461.                                         <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3462.                                     </div>
  3463.                                 </div>
  3464.                                 <tr>
  3465.                                     <td>
  3466.                                         <div class="InnerTableContainer" >
  3467.                                             <table style="width:100%;" >
  3468.                                                 <tr>
  3469.                                                     <td>The new leader is '.$to_player->getName().'.</td>
  3470.                                                 </tr>
  3471.                                             </table>
  3472.                                         </div>
  3473.                                     </td>
  3474.                                 </tr>
  3475.                             </table>
  3476.                         </div><BR>
  3477.                         <TABLE BORDER=0 WIDTH=100%>
  3478.                             <TR>
  3479.                                 <TD ALIGN=center>
  3480.                                     <table border="0" cellspacing="0" cellpadding="0" >
  3481.                                         <form action="?subtopic=guilds" method="post" >
  3482.                                             <input type="hidden" name="action" value="view">
  3483.                                             <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'">
  3484.                                             <tr>
  3485.                                                 <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  3486.                                                         <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  3487.                                                             <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  3488.                                                         </div>
  3489.                                                     </div>
  3490.                                                 </td>
  3491.                                             </tr>
  3492.                                         </form>
  3493.                                     </table>
  3494.                                 </TD>
  3495.                             </TR>
  3496.                         </TABLE>';
  3497.                 } else {
  3498.                     //formulario com as ações
  3499.                     $main_content .= '
  3500.                         Select a member to your new Guild Leader and click "Submit" button.<BR><BR>
  3501.                         <FORM ACTION="?subtopic=guilds" METHOD=post>
  3502.                             <div class="TableContainer" >
  3503.                                 <table class="Table1" cellpadding="0" cellspacing="0" >
  3504.                                     <div class="CaptionContainer" >
  3505.                                         <div class="CaptionInnerContainer" >
  3506.                                             <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3507.                                             <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3508.                                             <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3509.                                             <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3510.                                             <div class="Text" >Resign Leadership</div>
  3511.                                             <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3512.                                             <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3513.                                             <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3514.                                             <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3515.                                         </div>
  3516.                                     </div>
  3517.                                     <tr>
  3518.                                         <td>
  3519.                                             <div class="InnerTableContainer" >
  3520.                                                 <table style="width:100%;" >
  3521.                                                     <TR>
  3522.                                                         <TD BGCOLOR=#D4C0A1>
  3523.                                                             <TABLE BORDER=0 CELLPADDING=1>
  3524.                                                                 <TR>
  3525.                                                                     <TD>
  3526.                                                                         <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=1>
  3527.                                                                             <TR>
  3528.                                                                                 <TD>Resign Leadership to:</TD>
  3529.                                                                             </TR>
  3530.                                                                         </TABLE>
  3531.                                                                     </TD>
  3532.                                                                     <TD>&#160;&#160;&#160;</TD>
  3533.                                                                     <TD>
  3534.                                                                         <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=1>
  3535.                                                                             <TR>
  3536.                                                                                 <TD align="right" valign="top">
  3537.                                                                                     <SELECT NAME="character">';
  3538.                                                                                 $rank_list = $guild->getGuildRanksList();
  3539.                                                                                 foreach($rank_list as $rank) {
  3540.                                                                                     $players_with_rank = $rank->getPlayersList();
  3541.                                                                                     foreach($players_with_rank as $player) {
  3542.                                                                                         if($guild_leader_char->getName() != $player->getName()) {
  3543.                                                                                             $main_content .= '<OPTION>' . $player->getName() . '</OPTION>';
  3544.                                                                                         }
  3545.                                                                                     }
  3546.                                                                                 }
  3547.                                                                                 $main_content .='
  3548.                                                                                     </SELECT>
  3549.                                                                                 </TD>
  3550.                                                                             </TR>
  3551.                                                                         </TABLE>
  3552.                                                                     </TD>
  3553.                                                                 </TR>
  3554.                                                             </TABLE>
  3555.                                                         </TD>
  3556.                                                     </TR>
  3557.                                                     <TR>
  3558.                                                         <TD>
  3559.                                                             <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=1>
  3560.                                                                 <TR>
  3561.                                                                     <TD>Password:</TD>
  3562.                                                                     <TD><input type="password" name="password"></TD>
  3563.                                                                 </TR>
  3564.                                                             </TABLE>
  3565.                                                         </TD>
  3566.                                                     </TR>
  3567.                                                 </table>
  3568.                                             </div>
  3569.                                         </td>
  3570.                                     </tr>
  3571.                                 </table>
  3572.                             </div>
  3573.                         <BR>
  3574.                         <TABLE BORDER=0 WIDTH=100%>
  3575.                             <TR align="center">
  3576.                                 <TD ALIGN=center>
  3577.                                     <table border="0" cellspacing="0" cellpadding="0" >
  3578.                                         <tr>
  3579.                                             <td style="border:0px;" >
  3580.                                                 <input type="hidden" name=action value=resignleadership >
  3581.                                                 <input type="hidden" name="resign" value="yes">
  3582.                                                 <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  3583.                                                 <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  3584.                                                     <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  3585.                                                         <input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/global/buttons/_sbutton_submit.gif" >
  3586.                                                     </div>
  3587.                                                 </div>
  3588.                                             </td>
  3589.                                         <tr>
  3590.                                     </table>
  3591.                                 </TD>
  3592.                                 </FORM>
  3593.                                 <TD ALIGN=center>
  3594.                                     <table border="0" cellspacing="0" cellpadding="0" >
  3595.                                         <form action="?subtopic=guilds&action=view" method="post" >
  3596.                                             <tr>
  3597.                                                 <td style="border:0px;" >
  3598.                                                     <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  3599.                                                     <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  3600.                                                         <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  3601.                                                             <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  3602.                                                         </div>
  3603.                                                     </div>
  3604.                                                 </td>
  3605.                                             </tr>
  3606.                                         </form>
  3607.                                     </table>
  3608.                                 </TD>
  3609.                             </TR>
  3610.                         </TABLE>';
  3611.                 }
  3612.             }
  3613.             else
  3614.                 $guild_errors[] = 'You are not a leader of guild!';
  3615.         }
  3616.         else
  3617.             $guild_errors[] = 'You are not logged. You can\'t manage guild.';
  3618.     }
  3619.     if(!empty($guild_errors)) {
  3620.         //errors
  3621.             $main_content .= '
  3622.                 <div class="TableContainer" >
  3623.                     <table class="Table1" cellpadding="0" cellspacing="0" >
  3624.                         <div class="CaptionContainer" >
  3625.                             <div class="CaptionInnerContainer" >
  3626.                                 <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3627.                                 <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3628.                                 <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3629.                                 <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3630.                                 <div class="Text" >Guild Leadership Error</div>
  3631.                                 <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3632.                                 <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3633.                                 <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3634.                                 <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3635.                             </div>
  3636.                         </div>
  3637.                         <tr>
  3638.                             <td>
  3639.                                 <div class="InnerTableContainer" >
  3640.                                     <table style="width:100%;" >
  3641.                                         <tr>
  3642.                                             <td>';
  3643.                                             foreach($guild_errors as $guild_error)
  3644.                                                 $main_content .= '<p>'.$guild_error;
  3645.                                         $main_content .= '
  3646.                                             </td>
  3647.                                         </tr>
  3648.                                     </table>
  3649.                                 </div>
  3650.                             </td>
  3651.                         </tr>
  3652.                     </table>
  3653.                 </div><BR>
  3654.                 <TABLE BORDER=0 WIDTH=100%>
  3655.                     <TR>
  3656.                         <TD ALIGN=center>
  3657.                             <table border="0" cellspacing="0" cellpadding="0" >
  3658.                                 <form action="?subtopic=guilds" method="post" >
  3659.                                     <input type="hidden" name="action" value="view">
  3660.                                     <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'">
  3661.                                     <tr>
  3662.                                         <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  3663.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  3664.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  3665.                                                 </div>
  3666.                                             </div>
  3667.                                         </td>
  3668.                                     </tr>
  3669.                                 </form>
  3670.                             </table>
  3671.                         </TD>
  3672.                     </TR>
  3673.                 </TABLE>';
  3674.     }
  3675. }
  3676. if($action == "guildwars") {
  3677.  
  3678.     # Guild wars status
  3679.     # 1 - War Started
  3680.     # 2 - War Rejected
  3681.     # 3 - War Canceled
  3682.  
  3683.  
  3684.     $guild_name = (string) $_REQUEST['GuildName'];
  3685.     $guild = new Guild();
  3686.     $guild->loadByName($guild_name);
  3687.     if(!$guild->isLoaded())
  3688.         $guild_errors[] = 'Guild with name <b>'.$guild_name.'</b> doesn\'t exist.';
  3689.  
  3690.     $guild_id = $guild->getID();
  3691.     if(empty($guild_errors)) {
  3692.         //check is it vice or/and leader account (leader has vice + leader rights)
  3693.         $guild_leader_char = $guild->getOwner();
  3694.         $rank_list = $guild->getGuildRanksList();
  3695.         $guild_leader = FALSE;
  3696.         $guild_vice = FALSE;
  3697.         if($logged)
  3698.         {
  3699.             $account_players = $account_logged->getPlayers();
  3700.             foreach($account_players as $player)
  3701.             {
  3702.                 $players_from_account_ids[] = $player->getId();
  3703.                 $player_rank = $player->getRank();
  3704.                 if(!empty($player_rank))
  3705.                     foreach($rank_list as $rank_in_guild)
  3706.                         if($rank_in_guild->getId() == $player_rank->getId())
  3707.                         {
  3708.                             $players_from_account_in_guild[] = $player->getName();
  3709.                             if($player_rank->getLevel() > 1)
  3710.                             {
  3711.                                 $guild_vice = TRUE;
  3712.                                 $level_in_guild = $player_rank->getLevel();
  3713.                             }
  3714.                             if($guild->getOwner()->getId() == $player->getId())
  3715.                             {
  3716.                                 $guild_vice = TRUE;
  3717.                                 $guild_leader = TRUE;
  3718.                             }
  3719.                         }
  3720.             }
  3721.         }
  3722.     }
  3723.     if($guild_leader)
  3724.         $main_content .= '
  3725.             <center>
  3726.                 <table border="0" cellspacing="0" cellpadding="0" >
  3727.                     <form action="?subtopic=guilds" method="post" >
  3728.                         <tr>
  3729.                             <td style="border:0px;" >
  3730.                                 <input type="hidden" name=action value=declarewar >
  3731.                                 <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  3732.                                 <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  3733.                                     <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  3734.                                         <input class="ButtonText" type="image" name="Declare War" alt="Declare War" src="'.$layout_name.'/images/global/buttons/_sbutton_declarewar.gif" >
  3735.                                     </div>
  3736.                                 </div>
  3737.                             </td>
  3738.                         </tr>
  3739.                     </form>
  3740.                 </table>
  3741.             </center>
  3742.             <br/>';
  3743.             /*
  3744.         $main_content .= '
  3745.             <div class="TableContainer" >
  3746.                 <table class="Table5" cellpadding="0" cellspacing="0" >
  3747.                     <div class="CaptionContainer" >
  3748.                         <div class="CaptionInnerContainer" >
  3749.                             <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3750.                             <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3751.                             <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3752.                             <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3753.                             <div class="Text" >Declarations of War</div>
  3754.                             <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3755.                             <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3756.                             <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3757.                             <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3758.                         </div>
  3759.                     </div>
  3760.                     <tr>
  3761.                         <td><div class="InnerTableContainer" >
  3762.                                 <table style="width:100%;" >
  3763.                                     <tr>
  3764.                                         <td>The guild Lino Lucky has currently no open war declarations.</td>
  3765.                                     </tr>
  3766.                                 </table>
  3767.                             </div>
  3768.                         </td>
  3769.                     </tr>
  3770.                 </table>
  3771.             </div>
  3772.             <br/>';
  3773.             */
  3774.             $main_content .= "<script type=\"text/javascript\"><!--
  3775.         function show_hide(flip)
  3776.         {
  3777.                 var tmp = document.getElementById(flip);
  3778.                 if(tmp)
  3779.                         tmp.style.display = tmp.style.display == 'none' ? '' : 'none';
  3780.         }
  3781.         --></script>";
  3782.     $main_content .= '
  3783.         <div class="TableContainer" >
  3784.             <table class="Table5" cellpadding="0" cellspacing="0" >
  3785.                 <div class="CaptionContainer" >
  3786.                     <div class="CaptionInnerContainer" >
  3787.                         <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3788.                         <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3789.                         <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3790.                         <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3791.                         <div class="Text" >Guild Wars</div>
  3792.                         <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3793.                         <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3794.                         <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3795.                         <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3796.                     </div>
  3797.                 </div>
  3798.                 <tr>
  3799.                     <td>
  3800.                         <div class="InnerTableContainer" >
  3801.                             <table style="width:100%;" >';
  3802.                             $main_content .= '
  3803.                                 <tr>
  3804.                                     <td>
  3805.                                         <div class="TableShadowContainerRightTop" >
  3806.                                                 <div class="TableShadowRightTop" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rt.gif);" ></div>
  3807.                                             </div>
  3808.                                             <div class="TableContentAndRightShadow" style="background-image:url('.$layout_name.'/images/global/content/table-shadow-rm.gif);" >
  3809.                                                 <div class="TableContentContainer" >
  3810.                                                     <table class="TableContent" width="100%" >
  3811.                                                         <tr class="LabelV">
  3812.                                                             <td>Aggressor</td>
  3813.                                                             <td>Information</td>
  3814.                                                             <td>Enemy</td>
  3815.                                                         </tr>';
  3816.                                                         $warFrags = array();
  3817.                                                         foreach($SQL->query('SELECT * FROM `guildwar_kills` WHERE `killerguild` = ' . $guild_id . ' OR `targetguild` = ' . $guild_id . ' ORDER BY `time` DESC')->fetchAll() as $frag)
  3818.                                                         {
  3819.                                                             $warFrags[$frag['warid']][] = $frag;
  3820.                                                         }
  3821.  
  3822.                                                         $count = 0;
  3823.                                                         foreach($SQL->query('SELECT `guild_wars`.`id`, `guild_wars`.`guild1`, `guild_wars`.`guild2`, `guild_wars`.`name1`, `guild_wars`.`name2`, `guild_wars`.`status`, `guild_wars`.`started`, `guild_wars`.`ended`, (SELECT COUNT(1) FROM `guildwar_kills` WHERE `guildwar_kills`.`warid` = `guild_wars`.`id` AND `guildwar_kills`.`killerguild` = `guild_wars`.`guild1`) guild1_kills, (SELECT COUNT(1) FROM `guildwar_kills` WHERE `guildwar_kills`.`warid` = `guild_wars`.`id` AND `guildwar_kills`.`killerguild` = `guild_wars`.`guild2`) guild2_kills FROM `guild_wars` WHERE `guild1` = ' . $guild_id . ' OR `guild2` = ' . $guild_id . ' ORDER BY CASE `status` WHEN 0 THEN 2 WHEN 1 THEN 1 WHEN 4 THEN 3 WHEN 3 THEN 4 WHEN 2 THEN 5 END, `started` DESC') as $war)
  3824.                                                         {
  3825.                                                             $count++;
  3826.                                                             $main_content .= "<tr style=\"background: " . (is_int($count / 2) ? $config['site']['darkborder'] : $config['site']['lightborder']) . ";\">
  3827.                                                         <td align=\"center\"><a href=\"?subtopic=guilds&action=view&GuildName=".$war['name1']."\"><img src=\"guild_image.php?id=" . $war['guild1'] . "\" width=\"64\" height=\"64\" border=\"0\"/><br />".htmlspecialchars($war['name1'])."</a></td>
  3828.                                                         <td align=\"center\">";
  3829.                                                             switch($war['status'])
  3830.                                                             {
  3831.                                                                 case 0:
  3832.                                                                 {
  3833.                                                                     $main_content .= "<b>Pending acceptation</b><br />Invited on " . date("M d Y, H:i:s", $war['started']) . " for " . (($war['ended'] - $war['started']) / 3600) . " hours war.<br />";
  3834.                                                                     if($guild_leader && $war['guild2'] == $guild->getID())
  3835.                                                                     {
  3836.                                                                         $main_content .= '<br /><a href="?subtopic=guilds&action=guildwar_accept&GuildName=' . $guild_name . '&war=' . $war['id'] . '" onclick="return confirm(\'Are you sure that you want ACCEPT that invitation for 2 hours war?\');" style="cursor: pointer;">accept invitation to war</a>';
  3837.                                                                         $main_content .= '<br /><br /><a href="?subtopic=guilds&action=guildwar_reject&GuildName=' . $guild_name . '&war=' . $war['id'] . '" onclick="return confirm(\'Are you sure that you want REJECT that invitation for 2 hours war?\');" style="cursor: pointer;">reject invitation to war</a>';
  3838.                                                                     }
  3839.                                                                     if($guild_leader && $war['guild1'] == $guild->getID())
  3840.                                                                     {
  3841.                                                                         $main_content .= '<br /><br /><a href="?subtopic=guilds&action=guildwar_cancel&GuildName=' . $guild_name . '&war=' . $war['id'] . '" onclick="return confirm(\'Are you sure that you want CANCEL that invitation for 2 hours war?\');" style="cursor: pointer;">cancel invitation to war</a>';
  3842.                                                                     }
  3843.                                                                     $main_content .= '</font>';
  3844.                                                                     break;
  3845.                                                                 }
  3846.                                                                 case 1:
  3847.                                                                 {
  3848.                                                                     $main_content .= "<font size=\"12\"><span style=\"color: red;\">" . $war['guild1_kills'] . "</span><font color=black> : </font><span style=\"color: lime;\">" . $war['guild2_kills'] . "</span></font><br /><br /><span style=\"color: darkred; font-weight: bold;\">On a brutal war</span><br /><font color=black>Began on " . date("M d Y, H:i:s", $war['started']) . ", will end up after server restart after " . date("M d Y, H:i:s", $war['started'] + (2*3600)) . ".<br /></font>";
  3849.                                                                     $main_content .= "<br /><br />";
  3850.                                                                     if(in_array($war['status'], array(1,4)))
  3851.                                                                     {
  3852.                                                                         $main_content .= "<a onclick=\"show_hide('war-details:" . $war['id'] . "'); return false;\" style=\"cursor: pointer;\">War Details</a>";
  3853.                                                                     }
  3854.                                                                     break;
  3855.                                                                 }
  3856.                                                                 case 2:
  3857.                                                                 {
  3858.                                                                     $main_content .= "<b>Rejected invitation</b><br />Invited on " . date("M d Y, H:i:s", $war['started']) . ", rejected on " . date("M d Y, H:i:s", $war['ended']) . ".</font>";
  3859.                                                                     break;
  3860.                                                                 }
  3861.                                                                 case 3:
  3862.                                                                 {
  3863.                                                                     $main_content .= "<b>Canceled invitation</b><br />Sent invite on " . date("M d Y, H:i:s", $war['started']) . ", canceled on " . date("M d Y, H:i:s", $war['ended']) . ".</font>";
  3864.                                                                     break;
  3865.                                                                 }
  3866.                                                                 case 4:
  3867.                                                                 {
  3868.                                                                     $main_content .= "<b><i>Ended</i></b><br />Began on " . date("M d Y, H:i:s", $war['started']) . ", ended on " . date("M d Y, H:i:s", $war['ended']) . ". Frag statistics: <span style=\"color: red;\">" . $war['guild1_kills'] . "</span> to <span style=\"color: lime;\">" . $war['guild2_kills'] . "</span>.";
  3869.                                                                     $main_content .= "<br /><br />";
  3870.                                                                     if(in_array($war['status'], array(1,4)))
  3871.                                                                     {
  3872.                                                                         $main_content .= "<a onclick=\"show_hide('war-details:" . $war['id'] . "'); return false;\" style=\"cursor: pointer;\">&raquo; Details &laquo;</a>";
  3873.                                                                     }
  3874.                                                                     $main_content .= "</font>";
  3875.                                                                     break;
  3876.                                                                 }
  3877.                                                                 default:
  3878.                                                                 {
  3879.                                                                     $main_content .= "Unknown, please contact with gamemaster.";
  3880.                                                                     break;
  3881.                                                                 }
  3882.                                                             }
  3883.                                                             $main_content .= "</td>
  3884.                                                         <td align=\"center\"><a href=\"?subtopic=guilds&action=view&GuildName=".$war['name2']."\"><img src=\"guild_image.php?id=" . $war['guild2'] . "\" width=\"64\" height=\"64\" border=\"0\"/><br />".htmlspecialchars($war['name2'])."</a></td>
  3885.                                                         </tr>
  3886.                                                         <tr id=\"war-details:" . $war['id'] . "\" style=\"display: none; background: " . (is_int($count / 2) ? $config['site']['darkborder'] : $config['site']['lightborder']) . ";\">
  3887.                                                         <td colspan=\"3\">";
  3888.                                                             if(in_array($war['status'], array(1,4)))
  3889.                                                             {
  3890.                                                                 if(isset($warFrags[$war['id']]))
  3891.                                                                 {
  3892.                                                                     foreach($warFrags[$war['id']] as $frag)
  3893.                                                                     {
  3894.                                                                         $main_content .= date("j M Y, H:i", $frag['time']) . " <span style=\"font-weight: bold; color: " . ($frag['killerguild'] == $war['guild1'] ? "red" :"lime") . ";\">+</span><a href=\"?subtopic=characters&name=" . urlencode($frag['killer']) . "\"><b>".htmlspecialchars($frag['killer'])."</b></a> killed <a href=\"?subtopic=characters&name=".urlencode($frag['target'])."\"> " . htmlspecialchars($frag['target']) . "</a>";
  3895.                                                                     }
  3896.                                                                 }
  3897.                                                                 else
  3898.                                                                     $main_content .= "<center>There were no frags on this war so far.</center>";
  3899.                                                             }
  3900.                                                             else
  3901.                                                                 $main_content .= "</td></tr>";
  3902.                                                         }
  3903.                                                 $main_content .= '
  3904.                                                     </table>
  3905.                                                 </div>
  3906.                                             </div>
  3907.                                         </div>
  3908.                                     </td>
  3909.                                 </tr>';
  3910.                         if($count == 0)
  3911.                             $main_content .= "
  3912.                                 <tr>
  3913.                                     <td>The guild ".$guild_name." is currently not involved in a guild war.</td>
  3914.                                 </tr>";
  3915.                         $main_content .= '
  3916.                             </table>
  3917.                         </div>
  3918.                     </td>
  3919.                 </tr>
  3920.             </table>
  3921.         </div>
  3922.         <br/>';
  3923.         /*
  3924.     $main_content .= '
  3925.         <div class="TableContainer" >
  3926.             <table class="Table5" cellpadding="0" cellspacing="0" >
  3927.                 <div class="CaptionContainer" >
  3928.                     <div class="CaptionInnerContainer" >
  3929.                         <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3930.                         <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3931.                         <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3932.                         <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3933.                         <div class="Text" >Guild War History</div>
  3934.                         <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>
  3935.                         <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>
  3936.                         <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3937.                         <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>
  3938.                     </div>
  3939.                 </div>
  3940.                 <tr>
  3941.                     <td>
  3942.                         <div class="InnerTableContainer">
  3943.                             <table style="width:100%;">
  3944.                                 <tr>
  3945.                                     <td>The guild Lino Lucky has never participated in a guild war.</td>
  3946.                                 </tr>
  3947.                             </table>
  3948.                         </div>
  3949.                     </td>
  3950.                 </tr>
  3951.             </table>
  3952.         </div>
  3953.         <br/>';
  3954.         */
  3955.     $main_content .= '
  3956.         <center>
  3957.             <table border="0" cellspacing="0" cellpadding="0" >
  3958.                 <form action="?subtopic=guilds&action=view" method="post" >
  3959.                     <tr>
  3960.                         <td style="border:0px;" >
  3961.                             <input type="hidden" name=GuildName value="'.$_REQUEST['GuildName'].'" >
  3962.                             <div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  3963.                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  3964.                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  3965.                                 </div>
  3966.                             </div>
  3967.                         </td>
  3968.                     </tr>
  3969.                 </form>
  3970.             </table>
  3971.         </center>
  3972.         ';
  3973. }
  3974. if($action == 'declarewar')
  3975. {
  3976.     $guild_name = (string) $_REQUEST['GuildName'];
  3977.     if(!$logged)
  3978.         $guild_errors[] = 'You are not logged.';
  3979.     if(empty($guild_errors))
  3980.     {
  3981.         $guild = new Guild();
  3982.         $guild->loadByName($guild_name);
  3983.         if(!$guild->isLoaded())
  3984.             $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
  3985.         if(empty($guild_errors))
  3986.         {
  3987.             $guild_leader_char = $guild->getOwner();
  3988.             $guild_leader = FALSE;
  3989.             $account_players = $account_logged->getPlayers();
  3990.             foreach($account_players as $player)
  3991.             {
  3992.                 if($guild_leader_char->getId() == $player->getId())
  3993.                 {
  3994.                     $guild_leader = TRUE;
  3995.                 }
  3996.             }
  3997.             if($guild_leader)
  3998.             {
  3999.                 $currentWars = array();
  4000.                 $wars = new DatabaseList('GuildWar');
  4001.                 foreach($wars as $war)
  4002.                 {
  4003.                     if($war->getStatus() == GuildWar::STATE_INVITED || $war->getStatus() == GuildWar::STATE_ON_WAR)
  4004.                     {
  4005.                         if($war->getGuild1ID() == $guild->getID())
  4006.                             $currentWars[$war->getGuild2ID()] = $war->getStatus();
  4007.                         elseif($war->getGuild2ID() == $guild->getID())
  4008.                             $currentWars[$war->getGuild1ID()] = $war->getStatus();
  4009.                     }
  4010.                 }
  4011.  
  4012.                 $main_content .= '<center><h1>' . htmlspecialchars($guild->getName()) . ' vs. ???</h2></center><br /><h3>Choose your enemy!</h3><br /><table width="100%" border="0" cellspacing="1" cellpadding="4">';
  4013.  
  4014.                 $guildsList = new DatabaseList('Guild');
  4015.                 $guildsList->addOrder(new SQL_Order(new SQL_Field('name'), SQL_Order::ASC));
  4016.                 $shown_guilds = 0;
  4017.                 foreach($guildsList as $enemyGuild)
  4018.                 {
  4019.                     if(is_int($shown_guilds / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $shown_guilds++;
  4020.                     $main_content .= '<tr BGCOLOR="'.$bgcolor.'"><td width="70px"><IMG SRC="guild_image.php?id='. $enemyGuild->getID() .'" WIDTH="64" HEIGHT="64"></td><td valign="top"><B>'.htmlspecialchars($enemyGuild->getName()).'</B></td><td>';
  4021.                     if($enemyGuild->getID() != $guild->getID())
  4022.                     {
  4023.                         if(isset($currentWars[$enemyGuild->getID()]))
  4024.                         {
  4025.                             // in war or invited
  4026.                             if($currentWars[$enemyGuild->getID()] == GuildWar::STATE_INVITED)
  4027.                             {
  4028.                                 // guild already invited you or you invited that guild
  4029.                                 $main_content .= 'There is already invitation between your and this guild.';
  4030.                             }
  4031.                             else
  4032.                             {
  4033.                                 // you are on war with this guild
  4034.                                 $main_content .= 'There is already war between your and this guild.';
  4035.                             }
  4036.                         }
  4037.                         else
  4038.                         {
  4039.                             // can invite
  4040.                             $main_content .= '<a href="?subtopic=guilds&action=guildwar_invite&GuildName=' . urlencode($guild->getName()) . '&enemy=' . $enemyGuild->getID() . '" onclick="return confirm(\'Are you sure that you want invite that guild?\')">INVITE FOR WAR</a>';
  4041.                         }
  4042.                     }
  4043.                     else
  4044.                     {
  4045.                         // your own guild
  4046.                         $main_content .= 'YOUR GUILD';
  4047.                     }
  4048.                     $main_content .= '</td></tr>';
  4049.                 }
  4050.                 $main_content .= '</table>';
  4051.             }
  4052.             else
  4053.                 $guild_errors[] = 'You are not a leader of guild!';
  4054.         }
  4055.     }
  4056.     if(!empty($guild_errors))
  4057.     {
  4058.         $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/global/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/global/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
  4059.         foreach($guild_errors as $guild_error)
  4060.             $main_content .= '<li>'.$guild_error.'</li>';
  4061.         $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/global/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></div>  </div></div><br>';
  4062.         $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" ></div></div></form></center>';
  4063.     }
  4064. }
  4065. if($action == 'guildwar_invite')
  4066. {
  4067.     $guild_name = (string) $_REQUEST['GuildName'];
  4068.     $enemy_id = (int) $_REQUEST['enemy'];
  4069.     if(!$logged)
  4070.         $guild_errors[] = 'You are not logged.';
  4071.     if(empty($guild_errors))
  4072.     {
  4073.         $guild = new Guild();
  4074.         $guild->loadByName($guild_name);
  4075.         $enemyGuild = new Guild($enemy_id);
  4076.         if(!$guild->isLoaded() || !$enemyGuild->isLoaded())
  4077.             $guild_errors[] = 'Guild <b>'.$guild_id.'</b> or <b>'.$enemy_id.'</b> doesn\'t exist.';
  4078.         if(empty($guild_errors))
  4079.         {
  4080.             $guild_leader_char = $guild->getOwner();
  4081.             $guild_leader = FALSE;
  4082.             $account_players = $account_logged->getPlayers();
  4083.             foreach($account_players as $player)
  4084.             {
  4085.                 if($guild_leader_char->getId() == $player->getId())
  4086.                 {
  4087.                     $guild_leader = TRUE;
  4088.                 }
  4089.             }
  4090.             if($guild_leader)
  4091.             {
  4092.                 if($enemyGuild->getID() != $guild->getID())
  4093.                 {
  4094.                     $currentWars = array();
  4095.                     $wars = new DatabaseList('GuildWar');
  4096.                     foreach($wars as $war)
  4097.                     {
  4098.                         if($war->getStatus() == GuildWar::STATE_INVITED || $war->getStatus() == GuildWar::STATE_ON_WAR)
  4099.                         {
  4100.                             if($war->getGuild1ID() == $guild->getID())
  4101.                                 $currentWars[$war->getGuild2ID()] = $war->getStatus();
  4102.                             elseif($war->getGuild2ID() == $guild->getID())
  4103.                                 $currentWars[$war->getGuild1ID()] = $war->getStatus();
  4104.                         }
  4105.                     }
  4106.                     if(isset($currentWars[$enemyGuild->getID()]))
  4107.                     {
  4108.                         // in war or invited
  4109.                         if($currentWars[$enemyGuild->getID()] == GuildWar::STATE_INVITED)
  4110.                         {
  4111.                             // guild already invited you or you invited that guild
  4112.                             $guild_errors[] = 'There is already invitation between your and this guild.';
  4113.                         }
  4114.                         else
  4115.                         {
  4116.                             // you are on war with this guild
  4117.                             $guild_errors[] = 'There is already war between your and this guild.';
  4118.                         }
  4119.                     }
  4120.                     else
  4121.                     {
  4122.                         // can invite
  4123.                         $war = new GuildWar();
  4124.                         $war->setGuild1ID($guild->getID());
  4125.                         $war->setGuild2ID($enemyGuild->getID());
  4126.                         $war->setGuild1Name($guild->getName());
  4127.                         $war->setGuild2Name($enemyGuild->getName());
  4128.                         $war->setStatus(GuildWar::STATE_INVITED);
  4129.                         $war->setStarted(time());
  4130.                         $war->setEnded(0);
  4131.                         $war->save();
  4132.                         header("Location: ?subtopic=guilds&action=view&GuildName=".urlencode($guild_name)."");
  4133.                         $main_content .= 'War invitation sent. Redirecting...';
  4134.                     }
  4135.                 }
  4136.                 else
  4137.                 {
  4138.                     $guild_errors[] = 'You cannot invite same guild!';
  4139.                 }
  4140.             }
  4141.             else
  4142.                 $guild_errors[] = 'You are not a leader of guild!';
  4143.         }
  4144.     }
  4145.     if(!empty($guild_errors))
  4146.     {
  4147.         $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
  4148.         foreach($guild_errors as $guild_error)
  4149.             $main_content .= '<li>'.$guild_error.'</li>';
  4150.         $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
  4151.         $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
  4152.     }
  4153. }
  4154. if($action == 'guildwar_cancel')
  4155. {
  4156.     $guild_name = (string) $_REQUEST['GuildName'];
  4157.     $war_id = (int) $_REQUEST['war'];
  4158.     if(!$logged)
  4159.         $guild_errors[] = 'You are not logged.';
  4160.     if(empty($guild_errors))
  4161.     {
  4162.         $guild = new Guild();
  4163.         $guild->loadByName($guild_name);
  4164.         if(!$guild->isLoaded())
  4165.             $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
  4166.         if(empty($guild_errors))
  4167.         {
  4168.             $guild_leader_char = $guild->getOwner();
  4169.             $guild_leader = FALSE;
  4170.             $account_players = $account_logged->getPlayers();
  4171.             foreach($account_players as $player)
  4172.             {
  4173.                 if($guild_leader_char->getId() == $player->getId())
  4174.                 {
  4175.                     $guild_leader = TRUE;
  4176.                 }
  4177.             }
  4178.             if($guild_leader)
  4179.             {
  4180.                 $war = new GuildWar($war_id);
  4181.                 if(!$war->isLoaded())
  4182.                     $guild_errors[] = 'War with ID <b>'.$war_id.'</b> doesn\'t exist.';
  4183.  
  4184.                 if(empty($guild_errors))
  4185.                 {
  4186.                     if($war->getGuild1ID() != $guild->getID() || $war->getStatus() != GuildWar::STATE_INVITED)
  4187.                     {
  4188.                         $guild_errors[] = 'Your guild did not invite to that war.';
  4189.                     }
  4190.  
  4191.                     if(empty($guild_errors))
  4192.                     {
  4193.                         $war->setStatus(GuildWar::STATE_CANCELED);
  4194.                         $war->setEnded(time());
  4195.                         $war->save();
  4196.                         header("Location: ?subtopic=guilds&action=view&GuildName=".$guild_name."");
  4197.                         $main_content .= 'War invitation rejected. Redirecting...';
  4198.                     }
  4199.                 }
  4200.             }
  4201.             else
  4202.                 $guild_errors[] = 'You are not a leader of guild!';
  4203.         }
  4204.     }
  4205.     if(!empty($guild_errors))
  4206.     {
  4207.         $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
  4208.         foreach($guild_errors as $guild_error)
  4209.             $main_content .= '<li>'.$guild_error.'</li>';
  4210.         $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
  4211.         $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
  4212.     }
  4213. }
  4214. if($action == 'guildwar_reject')
  4215. {
  4216.     $guild_name = (string) $_REQUEST['GuildName'];
  4217.     $war_id = (int) $_REQUEST['war'];
  4218.     if(!$logged)
  4219.         $guild_errors[] = 'You are not logged.';
  4220.     if(empty($guild_errors))
  4221.     {
  4222.         $guild = new Guild();
  4223.         $guild->loadByName($guild_name);
  4224.         if(!$guild->isLoaded())
  4225.             $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
  4226.         if(empty($guild_errors))
  4227.         {
  4228.             $guild_leader_char = $guild->getOwner();
  4229.             $guild_leader = FALSE;
  4230.             $account_players = $account_logged->getPlayers();
  4231.             foreach($account_players as $player)
  4232.             {
  4233.                 if($guild_leader_char->getId() == $player->getId())
  4234.                 {
  4235.                     $guild_leader = TRUE;
  4236.                 }
  4237.             }
  4238.             if($guild_leader)
  4239.             {
  4240.                 $war = new GuildWar($war_id);
  4241.                 if(!$war->isLoaded())
  4242.                     $guild_errors[] = 'War with ID <b>'.$war_id.'</b> doesn\'t exist.';
  4243.  
  4244.                 if(empty($guild_errors))
  4245.                 {
  4246.                     if($war->getGuild2ID() != $guild->getID() || $war->getStatus() != GuildWar::STATE_INVITED)
  4247.                     {
  4248.                         $guild_errors[] = 'Your guild is not invited to that war.';
  4249.                     }
  4250.  
  4251.                     if(empty($guild_errors))
  4252.                     {
  4253.                         $war->setStatus(GuildWar::STATE_REJECTED);
  4254.                         $war->setEnded(time());
  4255.                         $war->save();
  4256.                         header("Location: ?subtopic=guilds&action=view&GuildName=".urlencode($guild_name)."");
  4257.                         $main_content .= 'War invitation rejected. Redirecting...';
  4258.                     }
  4259.                 }
  4260.             }
  4261.             else
  4262.                 $guild_errors[] = 'You are not a leader of guild!';
  4263.         }
  4264.     }
  4265.     if(!empty($guild_errors))
  4266.     {
  4267.         $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
  4268.         foreach($guild_errors as $guild_error)
  4269.             $main_content .= '<li>'.$guild_error.'</li>';
  4270.         $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
  4271.         $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
  4272.     }
  4273. }
  4274. if($action == 'guildwar_accept')
  4275. {
  4276.     $guild_name = (string) $_REQUEST['GuildName'];
  4277.     $war_id = (int) $_REQUEST['war'];
  4278.     if(!$logged)
  4279.         $guild_errors[] = 'You are not logged.';
  4280.     if(empty($guild_errors))
  4281.     {
  4282.         $guild = new Guild();
  4283.         $guild->loadByName($guild_name);
  4284.         if(!$guild->isLoaded())
  4285.             $guild_errors[] = 'Guild <b>'.$guild_name.'</b> doesn\'t exist.';
  4286.         if(empty($guild_errors))
  4287.         {
  4288.             $guild_leader_char = $guild->getOwner();
  4289.             $guild_leader = FALSE;
  4290.             $account_players = $account_logged->getPlayers();
  4291.             foreach($account_players as $player)
  4292.             {
  4293.                 if($guild_leader_char->getId() == $player->getId())
  4294.                 {
  4295.                     $guild_leader = TRUE;
  4296.                 }
  4297.             }
  4298.             if($guild_leader)
  4299.             {
  4300.                 $war = new GuildWar($war_id);
  4301.                 if(!$war->isLoaded())
  4302.                     $guild_errors[] = 'War with ID <b>'.$war_id.'</b> doesn\'t exist.';
  4303.  
  4304.                 if(empty($guild_errors))
  4305.                 {
  4306.                     if($war->getGuild2ID() != $guild->getID() || $war->getStatus() != GuildWar::STATE_INVITED)
  4307.                     {
  4308.                         $guild_errors[] = 'Your guild is not invited to that war.';
  4309.                     }
  4310.  
  4311.                     if(empty($guild_errors))
  4312.                     {
  4313.                         $war->setStatus(GuildWar::STATE_ON_WAR);
  4314.                         $war->setStarted(time());
  4315.                         $war->setEnded(0);
  4316.                         $war->save();
  4317.                         header("Location: ?subtopic=guilds&action=view&GuildName=".urlencode($guild_name)."");
  4318.                         $main_content .= 'War invitation accepted. Redirecting...';
  4319.                     }
  4320.                 }
  4321.             }
  4322.             else
  4323.                 $guild_errors[] = 'You are not a leader of guild!';
  4324.         }
  4325.     }
  4326.     if(!empty($guild_errors))
  4327.     {
  4328.         $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
  4329.         foreach($guild_errors as $guild_error)
  4330.             $main_content .= '<li>'.$guild_error.'</li>';
  4331.         $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br>';
  4332.         $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
  4333.     }
  4334. }
  4335. if($action == "guildevents") {
  4336.     $main_content .= '
  4337.         Page under construction
  4338.         <BR><BR>
  4339.                 <TABLE BORDER=0 WIDTH=100%>
  4340.                     <TR>
  4341.                         <TD ALIGN=center>
  4342.                             <table border="0" cellspacing="0" cellpadding="0" >
  4343.                                 <form action="?subtopic=guilds" method="post" >
  4344.                                     <input type="hidden" name="action" value="view">
  4345.                                     <input type="hidden" name="GuildName" value="'.$_REQUEST['GuildName'].'">
  4346.                                     <tr>
  4347.                                         <td style="border:0px;" ><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" >
  4348.                                                 <div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div>
  4349.                                                     <input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" >
  4350.                                                 </div>
  4351.                                             </div>
  4352.                                         </td>
  4353.                                     </tr>
  4354.                                 </form>
  4355.                             </table>
  4356.                         </TD>
  4357.                     </TR>
  4358.                 </TABLE>';
  4359. }
  4360. if($action == 'deletebyadmin')
  4361. {
  4362.     $guild_id = (int) $_REQUEST['guild'];
  4363.     if(empty($guild_errors))
  4364.     {
  4365.         $guild = new Guild();
  4366.         $guild->load($guild_id);
  4367.         if(!$guild->isLoaded())
  4368.             $guild_errors[] = 'Guild with ID <b>'.$guild_id.'</b> doesn\'t exist.';
  4369.     }
  4370.     if(empty($guild_errors))
  4371.     {
  4372.         if($logged)
  4373.         {
  4374.             if($group_id_of_acc_logged >= $config['site']['access_admin_panel'])
  4375.             {
  4376.                 if($_POST['todo'] == 'save')
  4377.                 {
  4378.                     $guild->delete();
  4379.                     $main_content .= '<div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Guild Deleted</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td>Guild with ID <b>'.$guild_id.'</b> has been deleted.</td></tr>          </table>        </div>  </table></div></td></tr><br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" ></div></div></form></center>';
  4380.                 }
  4381.                 else
  4382.                     $main_content .= '<div class="TableContainer" >  <table class="Table1" cellpadding="0" cellspacing="0" >    <div class="CaptionContainer" >      <div class="CaptionInnerContainer" >        <span class="CaptionEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>        <span class="CaptionBorderTop" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>        <span class="CaptionVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>        <div class="Text" >Guild Deleted</div>        <span class="CaptionVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></span>        <span class="CaptionBorderBottom" style="background-image:url('.$layout_name.'/images/global/content/table-headline-border.gif);" ></span>        <span class="CaptionEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>        <span class="CaptionEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></span>      </div>    </div>    <tr>      <td>        <div class="InnerTableContainer" >          <table style="width:100%;" ><tr><td>Are you sure you want delete guild <b>'.htmlspecialchars($guild->getName()).'</b>?<br>
  4383.                     <form action="?subtopic=guilds&guild='.$guild_id.'&action=deletebyadmin" METHOD=post><input type="hidden" name="todo" value="save"><input type="submit" value="Yes, delete"></form>
  4384.                     </td></tr>          </table>        </div>  </table></div></td></tr><br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" ></div></div></form></center>';
  4385.             }
  4386.             else
  4387.                 $guild_errors[] = 'You are not an admin!';
  4388.         }
  4389.         else
  4390.             $guild_errors[] = 'You are not logged. You can\'t delete guild.';
  4391.     }
  4392.     if(!empty($guild_errors))
  4393.     {
  4394.         $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/global/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/global/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/global/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
  4395.         foreach($guild_errors as $guild_error)
  4396.             $main_content .= '<li>'.$guild_error.'</li>';
  4397.         $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/global/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/global/content/box-frame-edge.gif);" /></div>  </div></div><br>';
  4398.         $main_content .= '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/global/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/global/buttons/_sbutton_back.gif" ></div></div></form></center>';
  4399.     }
  4400. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement