Guest User

Untitled

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