Advertisement
admauriaot

HYPER SHOPSYSTEM

Mar 18th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.53 KB | None | 0 0
  1. <img id="ContentBoxHeadline" class="Title" src="layouts/tibiacom/images/header/headline-shopsystem.gif" alt="Contentbox headline">
  2. <?php
  3. if(!defined('INITIALIZED'))
  4. exit;
  5.  
  6. if($config['site']['shop_system'])
  7. {
  8. if($logged)
  9. {
  10. $user_premium_points = $account_logged->getCustomField('premium_points');
  11. }
  12. else
  13. {
  14. $user_premium_points = 'Login first';
  15. }
  16. function getItemByID($id)
  17. {
  18. $id = (int) $id;
  19. $SQL = $GLOBALS['SQL'];
  20. $data = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_offer').' WHERE '.$SQL->fieldName('id').' = '.$SQL->quote($id).';')->fetch();
  21. if($data['offer_type'] == 'item')
  22. {
  23. $offer['id'] = $data['id'];
  24. $offer['type'] = $data['offer_type'];
  25. $offer['item_id'] = $data['itemid1'];
  26. $offer['item_count'] = $data['count1'];
  27. $offer['points'] = $data['points'];
  28. $offer['description'] = $data['offer_description'];
  29. $offer['name'] = $data['offer_name'];
  30. }
  31. elseif($data['offer_type'] == 'mount')
  32. {
  33. $offer['id'] = $data['id'];
  34. $offer['type'] = $data['offer_type'];
  35. $offer['item_id'] = $data['itemid1'];
  36. $offer['item_count'] = $data['count1'];
  37. $offer['points'] = $data['points'];
  38. $offer['description'] = $data['offer_description'];
  39. $offer['name'] = $data['offer_name'];
  40. }
  41. elseif($data['offer_type'] == 'addon')
  42. {
  43. $offer['id'] = $data['id'];
  44. $offer['type'] = $data['offer_type'];
  45. $offer['item_id'] = $data['itemid1'];
  46. $offer['item_count'] = $data['count1'];
  47. $offer['points'] = $data['points'];
  48. $offer['description'] = $data['offer_description'];
  49. $offer['name'] = $data['offer_name'];
  50. }
  51. elseif($data['offer_type'] == 'mage')
  52. {
  53. $offer['id'] = $data['id'];
  54. $offer['type'] = $data['offer_type'];
  55. $offer['item_id'] = $data['itemid1'];
  56. $offer['item_count'] = $data['count1'];
  57. $offer['points'] = $data['points'];
  58. $offer['description'] = $data['offer_description'];
  59. $offer['name'] = $data['offer_name'];
  60. }
  61. elseif($data['offer_type'] == 'pala')
  62. {
  63. $offer['id'] = $data['id'];
  64. $offer['type'] = $data['offer_type'];
  65. $offer['item_id'] = $data['itemid1'];
  66. $offer['item_count'] = $data['count1'];
  67. $offer['points'] = $data['points'];
  68. $offer['description'] = $data['offer_description'];
  69. $offer['name'] = $data['offer_name'];
  70. }
  71. elseif($data['offer_type'] == 'kina')
  72. {
  73. $offer['id'] = $data['id'];
  74. $offer['type'] = $data['offer_type'];
  75. $offer['item_id'] = $data['itemid1'];
  76. $offer['item_count'] = $data['count1'];
  77. $offer['points'] = $data['points'];
  78. $offer['description'] = $data['offer_description'];
  79. $offer['name'] = $data['offer_name'];
  80. }
  81. elseif($data['offer_type'] == 'deco')
  82. {
  83. $offer['id'] = $data['id'];
  84. $offer['type'] = $data['offer_type'];
  85. $offer['item_id'] = $data['itemid1'];
  86. $offer['item_count'] = $data['count1'];
  87. $offer['points'] = $data['points'];
  88. $offer['description'] = $data['offer_description'];
  89. $offer['name'] = $data['offer_name'];
  90. }
  91. elseif($data['offer_type'] == 'container')
  92. {
  93. $offer['id'] = $data['id'];
  94. $offer['type'] = $data['offer_type'];
  95. $offer['item_id'] = $data['itemid1'];
  96. $offer['item_count'] = $data['count1'];
  97. $offer['points'] = $data['points'];
  98. $offer['description'] = $data['offer_description'];
  99. $offer['name'] = $data['offer_name'];
  100. }
  101. return $offer;
  102. }
  103.  
  104. function getOfferArray()
  105. {
  106. $offer_list = $GLOBALS['SQL']->query('SELECT * FROM '.$GLOBALS['SQL']->tableName('z_shop_offer').';');
  107. $i_item = 0;
  108. $i_mount = 0;
  109. $i_addon = 0;
  110. $i_mage = 0;
  111. $i_pala = 0;
  112. $i_kina = 0;
  113. $i_deco = 0;
  114. $i_container = 0;
  115. while($data = $offer_list->fetch())
  116. {
  117. if($data['offer_type'] == 'item')
  118. {
  119. $offer_array['item'][$i_item]['id'] = $data['id'];
  120. $offer_array['item'][$i_item]['item_id'] = $data['itemid1'];
  121. $offer_array['item'][$i_item]['item_count'] = $data['count1'];
  122. $offer_array['item'][$i_item]['points'] = $data['points'];
  123. $offer_array['item'][$i_item]['description'] = $data['offer_description'];
  124. $offer_array['item'][$i_item]['name'] = $data['offer_name'];
  125. $i_item++;
  126. }
  127. elseif($data['offer_type'] == 'mount')
  128. {
  129. $offer_array['mount'][$i_mount]['id'] = $data['id'];
  130. $offer_array['mount'][$i_mount]['container_id'] = $data['itemid1'];
  131. $offer_array['mount'][$i_mount]['container_count'] = $data['count1'];
  132. $offer_array['mount'][$i_mount]['item_id'] = $data['itemid1'];
  133. $offer_array['mount'][$i_mount]['item_count'] = $data['count2'];
  134. $offer_array['mount'][$i_mount]['points'] = $data['points'];
  135. $offer_array['mount'][$i_mount]['description'] = $data['offer_description'];
  136. $offer_array['mount'][$i_mount]['name'] = $data['offer_name'];
  137. $i_mount++;
  138. }
  139. elseif($data['offer_type'] == 'addon')
  140. {
  141. $offer_array['addon'][$i_addon]['id'] = $data['id'];
  142. $offer_array['addon'][$i_addon]['container_id'] = $data['itemid1'];
  143. $offer_array['addon'][$i_addon]['container_count'] = $data['count1'];
  144. $offer_array['addon'][$i_addon]['item_id'] = $data['itemid1'];
  145. $offer_array['addon'][$i_addon]['item_count'] = $data['count2'];
  146. $offer_array['addon'][$i_addon]['points'] = $data['points'];
  147. $offer_array['addon'][$i_addon]['description'] = $data['offer_description'];
  148. $offer_array['addon'][$i_addon]['name'] = $data['offer_name'];
  149. $i_addon++;
  150. }
  151. elseif($data['offer_type'] == 'mage')
  152. {
  153. $offer_array['mage'][$i_mage]['id'] = $data['id'];
  154. $offer_array['mage'][$i_mage]['container_id'] = $data['itemid1'];
  155. $offer_array['mage'][$i_mage]['container_count'] = $data['count1'];
  156. $offer_array['mage'][$i_mage]['item_id'] = $data['itemid1'];
  157. $offer_array['mage'][$i_mage]['item_count'] = $data['count2'];
  158. $offer_array['mage'][$i_mage]['points'] = $data['points'];
  159. $offer_array['mage'][$i_mage]['description'] = $data['offer_description'];
  160. $offer_array['mage'][$i_mage]['name'] = $data['offer_name'];
  161. $i_mage++;
  162. }
  163. elseif($data['offer_type'] == 'pala')
  164. {
  165. $offer_array['pala'][$i_pala]['id'] = $data['id'];
  166. $offer_array['pala'][$i_pala]['container_id'] = $data['itemid1'];
  167. $offer_array['pala'][$i_pala]['container_count'] = $data['count1'];
  168. $offer_array['pala'][$i_pala]['item_id'] = $data['itemid1'];
  169. $offer_array['pala'][$i_pala]['item_count'] = $data['count2'];
  170. $offer_array['pala'][$i_pala]['points'] = $data['points'];
  171. $offer_array['pala'][$i_pala]['description'] = $data['offer_description'];
  172. $offer_array['pala'][$i_pala]['name'] = $data['offer_name'];
  173. $i_pala++;
  174. }
  175. elseif($data['offer_type'] == 'kina')
  176. {
  177. $offer_array['kina'][$i_kina]['id'] = $data['id'];
  178. $offer_array['kina'][$i_kina]['container_id'] = $data['itemid1'];
  179. $offer_array['kina'][$i_kina]['container_count'] = $data['count1'];
  180. $offer_array['kina'][$i_kina]['item_id'] = $data['itemid1'];
  181. $offer_array['kina'][$i_kina]['item_count'] = $data['count2'];
  182. $offer_array['kina'][$i_kina]['points'] = $data['points'];
  183. $offer_array['kina'][$i_kina]['description'] = $data['offer_description'];
  184. $offer_array['kina'][$i_kina]['name'] = $data['offer_name'];
  185. $i_kina++;
  186. }
  187. elseif($data['offer_type'] == 'deco')
  188. {
  189. $offer_array['deco'][$i_deco]['id'] = $data['id'];
  190. $offer_array['deco'][$i_deco]['container_id'] = $data['itemid1'];
  191. $offer_array['deco'][$i_deco]['container_count'] = $data['count1'];
  192. $offer_array['deco'][$i_deco]['item_id'] = $data['itemid1'];
  193. $offer_array['deco'][$i_deco]['item_count'] = $data['count2'];
  194. $offer_array['deco'][$i_deco]['points'] = $data['points'];
  195. $offer_array['deco'][$i_deco]['description'] = $data['offer_description'];
  196. $offer_array['deco'][$i_deco]['name'] = $data['offer_name'];
  197. $i_deco++;
  198. }
  199. elseif($data['offer_type'] == 'container')
  200. {
  201. $offer_array['container'][$i_container]['id'] = $data['id'];
  202. $offer_array['container'][$i_container]['container_id'] = $data['itemid1'];
  203. $offer_array['container'][$i_container]['container_count'] = $data['count1'];
  204. $offer_array['container'][$i_container]['item_id'] = $data['itemid2'];
  205. $offer_array['container'][$i_container]['item_count'] = $data['count2'];
  206. $offer_array['container'][$i_container]['points'] = $data['points'];
  207. $offer_array['container'][$i_container]['description'] = $data['offer_description'];
  208. $offer_array['container'][$i_container]['name'] = $data['offer_name'];
  209. $i_container++;
  210. }
  211. }
  212. return $offer_array;
  213. }
  214. if(($action == '') or ($action == 'item') or ($action == 'mount') or ($action == 'addon') or ($action == 'container') or ($action == 'mage') or ($action == 'pala') or ($action == 'kina') or ($action == 'deco'))
  215. {
  216. unset($_SESSION['viewed_confirmation_page']);
  217. $offer_list = getOfferArray();
  218.  
  219. if(empty($action))
  220. {
  221. if(count($offer_list['item']) > 0)
  222. $action = 'item';
  223. elseif(count($offer_list['mount']) > 0)
  224. $action = 'mount';
  225. elseif(count($offer_list['addon']) > 0)
  226. $action = 'addon';
  227. elseif(count($offer_list['mage']) > 0)
  228. $action = 'mage';
  229. elseif(count($offer_list['pala']) > 0)
  230. $action = 'pala';
  231. elseif(count($offer_list['kina']) > 0)
  232. $action = 'kina';
  233. elseif(count($offer_list['deco']) > 0)
  234. $action = 'deco';
  235. elseif(count($offer_list['container']) > 0)
  236. $action = 'container';
  237. }
  238.  
  239. function selectcolor($value)
  240. {
  241. if($GLOBALS['action'] == $value)
  242. return '#505050; color: #FFFFFF';
  243. else
  244. return '#303030; color: #aaaaaa';
  245. }
  246.  
  247. if((count($offer_list['item']) > 0) or (count($offer_list['mount']) > 0) or (count($offer_list['addon']) > 0) or (count($offer_list['container']) > 0) or (count($offer_list['mage']) > 0) or (count($offer_list['pala']) > 0) or (count($offer_list['kina']) > 0) or (count($offer_list['deco']) > 0))
  248. {
  249. $main_content .= '<center><TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=4><TR>';
  250. if(count($offer_list['item']) > 0) $main_content .= '<center><a href="?subtopic=shopsystem&action=item" style="padding: 5px 5px 7px 5px; margin: 5px 1px 0px 1px; background-color: '.selectcolor('item').';">Items<img src="/images/items/2160.gif"></a>';
  251. if(count($offer_list['mount']) > 0) $main_content .= '<a href="?subtopic=shopsystem&action=mount" style="padding: 5px 5px 7px 5px; margin: 5px 1px 0px 1px; background-color: '.selectcolor('mount').';">Mounts<img src="/images/items/92.gif"></a>';
  252. if(count($offer_list['addon']) > 0) $main_content .= '<a href="?subtopic=shopsystem&action=addon" style="padding: 5px 5px 7px 5px; margin: 5px 1px 0px 1px; background-color: '.selectcolor('addon').';">Addons<img src="/images/items/128.gif"></a>';
  253. if(count($offer_list['mage']) > 0) $main_content .= '<a href="?subtopic=shopsystem&action=mage" style="padding: 5px 5px 7px 5px; margin: 5px 1px 0px 1px; background-color: '.selectcolor('mage').';">Mage<img src="/images/items/18390.gif"></a>';
  254. if(count($offer_list['pala']) > 0) $main_content .= '<a href="?subtopic=shopsystem&action=pala" style="padding: 5px 5px 7px 5px; margin: 5px 1px 0px 1px; background-color: '.selectcolor('pala').';">Pala<img src="/images/items/22421.gif"></a>';
  255. if(count($offer_list['kina']) > 0) $main_content .= '<a href="?subtopic=shopsystem&action=kina" style="padding: 5px 5px 7px 5px; margin: 5px 1px 0px 1px; background-color: '.selectcolor('kina').';">Kina<img src="/images/items/22409.gif"></a>';
  256. if(count($offer_list['container']) > 0) $main_content .= '<a href="?subtopic=shopsystem&action=container" style="padding: 5px 5px 7px 5px; margin: 5px 1px 0px 1px; background-color: '.selectcolor('container').';">Container</a></center>';
  257. $main_content .= '</TD></TR></TD></TR></table></center><table BORDER=0 CELLPaDDING="0" CELLSPaCING="3" style="width:100%;font-weight:bold;text-align:center;"><tr style="background:#505050;"><td colspan="3" style="height:px;"></td></tr></table>';
  258. }
  259.  
  260. //show list of items offers
  261. if((count($offer_list['item']) > 0) and ($action == 'item'))
  262. {
  263. $main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="8%" align="center" class="white"><b>Points</b></td><td width="9%" align="center" class="white"><b>Picture</b></td><td width="350" align="left" class="white"><b>Description</b></td><td width="250" align="center" class="white"><b>Select product</b></td></tr>';
  264. foreach($offer_list['item'] as $item)
  265. {
  266. if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
  267. $main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><b>'.$item['points'].'</b></td><td align="center"><img src="' . $config['site']['item_images_url'] . $item['item_id'] . $config['site']['item_images_extension'] . '"></td><td><b>'.htmlspecialchars($item['name']).'</b> ('.$item['points'].' points)<br />'.htmlspecialchars($item['description']).'</td><td align="center">';
  268. if(!$logged)
  269. {
  270. $main_content .= '<b>Login to buy</b>';
  271. }
  272. else
  273. {
  274. $main_content .= '<form action="?subtopic=shopsystem&action=select_player" method="POST" name="itemform_'.$item['id'].'"><input type="hidden" name="buy_id" value="'.$item['id'].'"><div class="navibutton"><a href="" onClick="itemform_'.$item['id'].'.submit();return false;">BUY</a></div></form>';
  275. }
  276. $main_content .= '</td></tr>';
  277. }
  278. $main_content .= '</table>';
  279. }
  280. //show list of mount offers
  281. if((count($offer_list['mount']) > 0) and ($action == 'mount'))
  282. {
  283. $main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="8%" align="center" class="white"><b>Points</b></td><td width="9%" align="center" class="white"><b>Picture</b></td><td width="350" align="left" class="white"><b>Description</b></td><td width="250" align="center" class="white"><b>Select product</b></td></tr>';
  284. foreach($offer_list['mount'] as $mount)
  285. {
  286. if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
  287. $main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><b>'.$mount['points'].'</b></td><td align="center"><img src="' . $config['site']['item_images_url'] . $mount['id'] . $config['site']['item_images_extension'] . '"></td><td><b>'.htmlspecialchars($mount['name']).'</b> ('.$mount['points'].' points)<br />'.htmlspecialchars($mount['description']).'</td><td align="center">';
  288. if(!$logged)
  289. {
  290. $main_content .= '<b>Login to buy</b>';
  291. }
  292. else
  293. {
  294. $main_content .= '<form action="?subtopic=shopsystem&action=select_player" method="POST" name="itemform_'.$mount['id'].'"><input type="hidden" name="buy_id" value="'.$mount['id'].'"><div class="navibutton"><a href="" onClick="itemform_'.$mount['id'].'.submit();return false;">BUY</a></div></form>';
  295. }
  296. $main_content .= '</td></tr>';
  297. }
  298. $main_content .= '</table>';
  299. }
  300. //show list of addon offers
  301. if((count($offer_list['addon']) > 0) and ($action == 'addon'))
  302. {
  303. $main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="8%" align="center" class="white"><b>Points</b></td><td width="9%" align="center" class="white"><b>Picture</b></td><td width="350" align="left" class="white"><b>Description</b></td><td width="250" align="center" class="white"><b>Select product</b></td></tr>';
  304. foreach($offer_list['addon'] as $addon)
  305. {
  306. if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
  307. $main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><b>'.$addon['points'].'</b></td><td align="center"><img src="' . $config['site']['item_images_url'] . $addon['id'] . $config['site']['item_images_extension'] . '"></td><td><b>'.htmlspecialchars($addon['name']).'</b> ('.$addon['points'].' points)<br />'.htmlspecialchars($addon['description']).'</td><td align="center">';
  308. if(!$logged)
  309. {
  310. $main_content .= '<b>Login to buy</b>';
  311. }
  312. else
  313. {
  314. $main_content .= '<form action="?subtopic=shopsystem&action=select_player" method="POST" name="itemform_'.$addon['id'].'"><input type="hidden" name="buy_id" value="'.$addon['id'].'"><div class="navibutton"><a href="" onClick="itemform_'.$addon['id'].'.submit();return false;">BUY</a></div></form>';
  315. }
  316. $main_content .= '</td></tr>';
  317. }
  318. $main_content .= '</table>';
  319. }
  320. //show list of mage offers
  321. if((count($offer_list['mage']) > 0) and ($action == 'mage'))
  322. {
  323. $main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="8%" align="center" class="white"><b>Points</b></td><td width="9%" align="center" class="white"><b>Picture</b></td><td width="350" align="left" class="white"><b>Description</b></td><td width="250" align="center" class="white"><b>Select product</b></td></tr>';
  324. foreach($offer_list['mage'] as $mage)
  325. {
  326. if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
  327. $main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><b>'.$mage['points'].'</b></td><td align="center"><img src="' . $config['site']['item_images_url'] . $mage['item_id'] . $config['site']['item_images_extension'] . '"></td><td><b>'.htmlspecialchars($mage['name']).'</b> ('.$mage['points'].' points)<br />'.htmlspecialchars($mage['description']).'</td><td align="center">';
  328. if(!$logged)
  329. {
  330. $main_content .= '<b>Login to buy</b>';
  331. }
  332. else
  333. {
  334. $main_content .= '<form action="?subtopic=shopsystem&action=select_player" method="POST" name="itemform_'.$mage['id'].'"><input type="hidden" name="buy_id" value="'.$mage['id'].'"><div class="navibutton"><a href="" onClick="itemform_'.$mage['id'].'.submit();return false;">BUY</a></div></form>';
  335. }
  336. $main_content .= '</td></tr>';
  337. }
  338. $main_content .= '</table>';
  339. }
  340. //show list of pala offers
  341. if((count($offer_list['pala']) > 0) and ($action == 'pala'))
  342. {
  343. $main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="8%" align="center" class="white"><b>Points</b></td><td width="9%" align="center" class="white"><b>Picture</b></td><td width="350" align="left" class="white"><b>Description</b></td><td width="250" align="center" class="white"><b>Select product</b></td></tr>';
  344. foreach($offer_list['pala'] as $pala)
  345. {
  346. if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
  347. $main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><b>'.$pala['points'].'</b></td><td align="center"><img src="' . $config['site']['item_images_url'] . $pala['item_id'] . $config['site']['item_images_extension'] . '"></td><td><b>'.htmlspecialchars($pala['name']).'</b> ('.$pala['points'].' points)<br />'.htmlspecialchars($pala['description']).'</td><td align="center">';
  348. if(!$logged)
  349. {
  350. $main_content .= '<b>Login to buy</b>';
  351. }
  352. else
  353. {
  354. $main_content .= '<form action="?subtopic=shopsystem&action=select_player" method="POST" name="itemform_'.$pala['id'].'"><input type="hidden" name="buy_id" value="'.$pala['id'].'"><div class="navibutton"><a href="" onClick="itemform_'.$pala['id'].'.submit();return false;">BUY</a></div></form>';
  355. }
  356. $main_content .= '</td></tr>';
  357. }
  358. $main_content .= '</table>';
  359. }
  360. //show list of kina offers
  361. if((count($offer_list['kina']) > 0) and ($action == 'kina'))
  362. {
  363. $main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="8%" align="center" class="white"><b>Points</b></td><td width="9%" align="center" class="white"><b>Picture</b></td><td width="350" align="left" class="white"><b>Description</b></td><td width="250" align="center" class="white"><b>Select product</b></td></tr>';
  364. foreach($offer_list['kina'] as $kina)
  365. {
  366. if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
  367. $main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><b>'.$kina['points'].'</b></td><td align="center"><img src="' . $config['site']['item_images_url'] . $kina['item_id'] . $config['site']['item_images_extension'] . '"></td><td><b>'.htmlspecialchars($kina['name']).'</b> ('.$kina['points'].' points)<br />'.htmlspecialchars($kina['description']).'</td><td align="center">';
  368. if(!$logged)
  369. {
  370. $main_content .= '<b>Login to buy</b>';
  371. }
  372. else
  373. {
  374. $main_content .= '<form action="?subtopic=shopsystem&action=select_player" method="POST" name="itemform_'.$kina['id'].'"><input type="hidden" name="buy_id" value="'.$kina['id'].'"><div class="navibutton"><a href="" onClick="itemform_'.$kina['id'].'.submit();return false;">BUY</a></div></form>';
  375. }
  376. $main_content .= '</td></tr>';
  377. }
  378. $main_content .= '</table>';
  379. }
  380. //show list of kina offers
  381. if((count($offer_list['deco']) > 0) and ($action == 'deco'))
  382. {
  383. $main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="8%" align="center" class="white"><b>Points</b></td><td width="9%" align="center" class="white"><b>Picture</b></td><td width="350" align="left" class="white"><b>Description</b></td><td width="250" align="center" class="white"><b>Select product</b></td></tr>';
  384. foreach($offer_list['deco'] as $deco)
  385. {
  386. if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
  387. $main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><b>'.$deco['points'].'</b></td><td align="center"><img src="' . $config['site']['item_images_url'] . $deco['item_id'] . $config['site']['item_images_extension'] . '"></td><td><b>'.htmlspecialchars($deco['name']).'</b> ('.$deco['points'].' points)<br />'.htmlspecialchars($deco['description']).'</td><td align="center">';
  388. if(!$logged)
  389. {
  390. $main_content .= '<b>Login to buy</b>';
  391. }
  392. else
  393. {
  394. $main_content .= '<form action="?subtopic=shopsystem&action=select_player" method="POST" name="itemform_'.$deco['id'].'"><input type="hidden" name="buy_id" value="'.$deco['id'].'"><div class="navibutton"><a href="" onClick="itemform_'.$deco['id'].'.submit();return false;">BUY</a></div></form>';
  395. }
  396. $main_content .= '</td></tr>';
  397. }
  398. $main_content .= '</table>';
  399. }
  400. //show list of containers offers
  401. if((count($offer_list['container']) > 0) and ($action == 'container'))
  402. {
  403. if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
  404. $main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="8%" align="center" class="white"><b>Points</b></td><td width="9%" align="center" class="white"><b>Picture</b></td><td width="350" align="left" class="white"><b>Description</b></td><td width="250" align="center" class="white"><b>Select product</b></td></tr>';
  405. foreach($offer_list['container'] as $container)
  406. {
  407. $main_content .= '<tr bgcolor="'.$bgcolor.'"><td align="center"><b>'.$container['points'].'</b></td><td align="center"><img src="' . $config['site']['item_images_url'] . $container['item_id'] . $config['site']['item_images_extension'] . '"></td><td><b>'.htmlspecialchars($container['name']).'</b> ('.$container['points'].' points)<br />'.htmlspecialchars($container['description']).'</td><td align="center">';
  408. if(!$logged)
  409. {
  410. $main_content .= '<b>Login to buy</b>';
  411. }
  412. else
  413. {
  414. $main_content .= '<form action="?subtopic=shopsystem&action=select_player" method="POST" name="contform_'.$container['id'].'"><input type="hidden" name="buy_id" value="'.$container['id'].'"><div class="navibutton"><a href="" onClick="contform_'.$container['id'].'.submit();return false;">BUY</a></div></form>';
  415. }
  416. $main_content .= '</td></tr>';
  417. }
  418. $main_content .= '</table>';
  419. }
  420. //Finish container
  421. if((count($offer_list['item']) > 0) or (count($offer_list['mount']) > 0) or (count($offer_list['addon']) > 0) or (count($offer_list['container']) > 0) or (count($offer_list['mage']) > 0) or (count($offer_list['pala']) > 0) or (count($offer_list['kina']) > 0))
  422. {
  423. $main_content .= '<table BORDER=0 CELLPaDDING="4" CELLSPaCING="1" style="width:100%;font-weight:bold;text-align:center;">
  424. <tr style="background:#505050;">
  425. <td colspan="3" style="height:px;"></td>
  426. </tr>
  427. </table>';
  428. }
  429. }
  430. if($action == 'select_player')
  431. {
  432. unset($_SESSION['viewed_confirmation_page']);
  433. if(!$logged) {
  434. $errormessage .= 'Please login first.';
  435. }
  436. else
  437. {
  438. $buy_id = (int) $_REQUEST['buy_id'];
  439. if(empty($buy_id))
  440. {
  441. $errormessage .= 'Please <a href="?subtopic=shopsystem">select item</a> first.';
  442. }
  443. else
  444. {
  445. $buy_offer = getItemByID($buy_id);
  446. if(isset($buy_offer['id'])) //item exist in database
  447. {
  448. if($user_premium_points >= $buy_offer['points'])
  449. {
  450. $main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%">
  451. <tr bgcolor="'.$config['site']['vdarkborder'].'"><td colspan="2" class="white"><b>Selected Offer</b></td></tr>
  452. <tr bgcolor="'.$config['site']['lightborder'].'"><td width="100"><b>Name:</b></td><td width="550">'.htmlspecialchars($buy_offer['name']).'</td></tr>
  453. <tr bgcolor="'.$config['site']['darkborder'].'"><td width="100"><b>Description:</b></td><td width="550">'.htmlspecialchars($buy_offer['description']).'</td></tr>
  454. </table><br />
  455. <form action="?subtopic=shopsystem&action=confirm_transaction" method="POST"><input type="hidden" name="buy_id" value="'.$buy_id.'">
  456. <table border="0" cellpadding="4" cellspacing="1" width="100%">
  457. <tr bgcolor="'.$config['site']['vdarkborder'].'"><td colspan="2" class="white"><b>Give item to player from your account</b></td></tr>
  458. <tr bgcolor="'.$config['site']['lightborder'].'"><td width="110"><b>Name:</b></td><td width="550"><select name="buy_name">';
  459. $players_from_logged_acc = $account_logged->getPlayersList();
  460. if(count($players_from_logged_acc) > 0)
  461. {
  462. foreach($players_from_logged_acc as $player)
  463. {
  464. $main_content .= '<option>'.htmlspecialchars($player->getName()).'</option>';
  465. }
  466. }
  467. else
  468. {
  469. $main_content .= 'You don\'t have any character on your account.';
  470. }
  471. $main_content .= '</select>&nbsp;<input type="submit" value="Give"></td></tr>
  472. </table>
  473. </form><br /><form action="?subtopic=shopsystem&action=confirm_transaction" method="POST"><input type="hidden" name="buy_id" value="'.$buy_id.'">
  474. <table border="0" cellpadding="4" cellspacing="1" width="100%">
  475. <tr bgcolor="'.$config['site']['vdarkborder'].'"><td colspan="2" class="white"><b>Give item to other player</b></td></tr>
  476. <tr bgcolor="'.$config['site']['lightborder'].'"><td width="110"><b>To player:</b></td><td width="550"><input type="text" name="buy_name"> - name of player</td></tr>
  477. <tr bgcolor="'.$config['site']['darkborder'].'"><td width="110"><b>From:</b></td><td width="550"><input type="text" name="buy_from">&nbsp;<input type="submit" value="Give"> - your nick, \'empty\' = Anonymous</td></tr>
  478. </table><br />
  479. </form>';
  480.  
  481. }
  482. else
  483. {
  484. $errormessage .= 'For this item you need <b>'.$buy_offer['points'].'</b> points. You have only <b>'.$user_premium_points.'</b> premium points. Please <a href="?subtopic=shopsystem">select other item</a> or buy premium points.';
  485. }
  486. }
  487. else
  488. {
  489. $errormessage .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please <a href="?subtopic=shopsystem">select item</a> again.';
  490. }
  491. }
  492. }
  493. if(!empty($errormessage))
  494. {
  495. $main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  496. <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Informations</B></TD></TR>
  497. <TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.$errormessage.'</b></TD></TR>
  498. </table>';
  499. }
  500. }
  501. elseif($action == 'confirm_transaction')
  502. {
  503. if(!$logged)
  504. {
  505. $errormessage .= 'Please login first.';
  506. }
  507. else
  508. {
  509. $buy_id = (int) $_POST['buy_id'];
  510. $buy_name = trim($_POST['buy_name']);
  511. $buy_from = trim($_POST['buy_from']);
  512. if(empty($buy_from))
  513. {
  514. $buy_from = 'Anonymous';
  515. }
  516. if(empty($buy_id))
  517. {
  518. $errormessage .= 'Please <a href="?subtopic=shopsystem">select item</a> first.';
  519. }
  520. else
  521. {
  522. if(!check_name($buy_from))
  523. {
  524. $errormessage .= 'Invalid nick ("from player") format. Please <a href="?subtopic=shopsystem&action=select_player&buy_id='.$buy_id.'">select other name</a> or contact with administrator.';
  525. }
  526. else
  527. {
  528. $buy_offer = getItemByID($buy_id);
  529. if(isset($buy_offer['id'])) //item exist in database
  530. {
  531. if($user_premium_points >= $buy_offer['points'])
  532. {
  533. if(check_name($buy_name))
  534. {
  535. $buy_player = new Player();
  536. $buy_player->find($buy_name);
  537. if($buy_player->isLoaded())
  538. {
  539. $buy_player_account = $buy_player->getAccount();
  540. if($_SESSION['viewed_confirmation_page'] == 'yes' && $_POST['buy_confirmed'] == 'yes')
  541. {
  542. if($buy_offer['type'] == 'item')
  543. {
  544. $sql = 'INSERT INTO '.$SQL->tableName('z_ots_comunication').' ('.$SQL->fieldName('id').','.$SQL->fieldName('name').','.$SQL->fieldName('type').','.$SQL->fieldName('action').','.$SQL->fieldName('param1').','.$SQL->fieldName('param2').','.$SQL->fieldName('param3').','.$SQL->fieldName('param4').','.$SQL->fieldName('param5').','.$SQL->fieldName('param6').','.$SQL->fieldName('param7').','.$SQL->fieldName('delete_it').') VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote('login').', '.$SQL->quote('give_item').', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', '.$SQL->quote('').', '.$SQL->quote('').', '.$SQL->quote('item').', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote($buy_offer['id']).', '.$SQL->quote(1).');';
  545. $SQL->query($sql);
  546. $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_item').' ('.$SQL->fieldName('id').','.$SQL->fieldName('to_name').','.$SQL->fieldName('to_account').','.$SQL->fieldName('from_nick').','.$SQL->fieldName('from_account').','.$SQL->fieldName('price').','.$SQL->fieldName('offer_id').','.$SQL->fieldName('trans_state').','.$SQL->fieldName('trans_start').','.$SQL->fieldName('trans_real').') VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote('wait').', '.$SQL->quote(time()).', '.$SQL->quote(0).');';
  547. $SQL->query($save_transaction);
  548. $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  549. $user_premium_points = $user_premium_points - $buy_offer['points'];
  550. $main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  551. <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Item added!</B></TD></TR>
  552. <TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.htmlspecialchars($buy_offer['name']).'</b> added to player <b>'.htmlspecialchars($buy_player->getName()).'</b> items (he will get this items after relog) for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br /><a href="?subtopic=shopsystem">GO TO MAIN SHOP SITE</a></TD></TR>
  553. </table>';
  554. }
  555. elseif($buy_offer['type'] == 'mount')
  556. {
  557. $sql = 'INSERT INTO '.$SQL->tableName('z_ots_comunication').' ('.$SQL->fieldName('id').','.$SQL->fieldName('name').','.$SQL->fieldName('type').','.$SQL->fieldName('action').','.$SQL->fieldName('param1').','.$SQL->fieldName('param2').','.$SQL->fieldName('param3').','.$SQL->fieldName('param4').','.$SQL->fieldName('param5').','.$SQL->fieldName('param6').','.$SQL->fieldName('param7').','.$SQL->fieldName('delete_it').') VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote('login').', '.$SQL->quote('give_item').', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', '.$SQL->quote('').', '.$SQL->quote('').', '.$SQL->quote('item').', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote($buy_offer['id']).', '.$SQL->quote(1).');';
  558. $SQL->query($sql);
  559. $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_item').' ('.$SQL->fieldName('id').','.$SQL->fieldName('to_name').','.$SQL->fieldName('to_account').','.$SQL->fieldName('from_nick').','.$SQL->fieldName('from_account').','.$SQL->fieldName('price').','.$SQL->fieldName('offer_id').','.$SQL->fieldName('trans_state').','.$SQL->fieldName('trans_start').','.$SQL->fieldName('trans_real').') VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote('wait').', '.$SQL->quote(time()).', '.$SQL->quote(0).');';
  560. $SQL->query($save_transaction);
  561. $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  562. $user_premium_points = $user_premium_points - $buy_offer['points'];
  563. $main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  564. <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Mount added!</B></TD></TR>
  565. <TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.htmlspecialchars($buy_offer['name']).'</b> added to player <b>'.htmlspecialchars($buy_player->getName()).'</b> items (he will get this items after relog) for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br /><a href="?subtopic=shopsystem">GO TO MAIN SHOP SITE</a></TD></TR>
  566. </table>';
  567. }
  568. elseif($buy_offer['type'] == 'addon')
  569. {
  570. $sql = 'INSERT INTO '.$SQL->tableName('z_ots_comunication').' ('.$SQL->fieldName('id').','.$SQL->fieldName('name').','.$SQL->fieldName('type').','.$SQL->fieldName('action').','.$SQL->fieldName('param1').','.$SQL->fieldName('param2').','.$SQL->fieldName('param3').','.$SQL->fieldName('param4').','.$SQL->fieldName('param5').','.$SQL->fieldName('param6').','.$SQL->fieldName('param7').','.$SQL->fieldName('delete_it').') VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote('login').', '.$SQL->quote('give_item').', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', '.$SQL->quote('').', '.$SQL->quote('').', '.$SQL->quote('item').', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote($buy_offer['id']).', '.$SQL->quote(1).');';
  571. $SQL->query($sql);
  572. $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_item').' ('.$SQL->fieldName('id').','.$SQL->fieldName('to_name').','.$SQL->fieldName('to_account').','.$SQL->fieldName('from_nick').','.$SQL->fieldName('from_account').','.$SQL->fieldName('price').','.$SQL->fieldName('offer_id').','.$SQL->fieldName('trans_state').','.$SQL->fieldName('trans_start').','.$SQL->fieldName('trans_real').') VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote('wait').', '.$SQL->quote(time()).', '.$SQL->quote(0).');';
  573. $SQL->query($save_transaction);
  574. $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  575. $user_premium_points = $user_premium_points - $buy_offer['points'];
  576. $main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  577. <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Addon added!</B></TD></TR>
  578. <TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.htmlspecialchars($buy_offer['name']).'</b> added to player <b>'.htmlspecialchars($buy_player->getName()).'</b> items (he will get this items after relog) for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br /><a href="?subtopic=shopsystem">GO TO MAIN SHOP SITE</a></TD></TR>
  579. </table>';
  580. }
  581. elseif($buy_offer['type'] == 'container')
  582. {
  583. $sql = 'INSERT INTO '.$SQL->tableName('z_ots_comunication').' ('.$SQL->fieldName('id').','.$SQL->fieldName('name').','.$SQL->fieldName('type').','.$SQL->fieldName('action').','.$SQL->fieldName('param1').','.$SQL->fieldName('param2').','.$SQL->fieldName('param3').','.$SQL->fieldName('param4').','.$SQL->fieldName('param5').','.$SQL->fieldName('param6').','.$SQL->fieldName('param7').','.$SQL->fieldName('delete_it').') VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote('login').', '.$SQL->quote('give_item').', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', '.$SQL->quote($buy_offer['container_id']).', '.$SQL->quote($buy_offer['container_count']).', '.$SQL->quote('container').', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote($buy_offer['id']).', '.$SQL->quote(1).');';
  584. $SQL->query($sql);
  585. $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_item').' ('.$SQL->fieldName('id').','.$SQL->fieldName('to_name').','.$SQL->fieldName('to_account').','.$SQL->fieldName('from_nick').','.$SQL->fieldName('from_account').','.$SQL->fieldName('price').','.$SQL->fieldName('offer_id').','.$SQL->fieldName('trans_state').','.$SQL->fieldName('trans_start').','.$SQL->fieldName('trans_real').') VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', '.$SQL->quote('wait').', '.$SQL->quote(time()).', '.$SQL->quote(0).');';
  586. $SQL->query($save_transaction);
  587. $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  588. $user_premium_points = $user_premium_points - $buy_offer['points'];
  589. $main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  590. <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Container of items added!</B></TD></TR>
  591. <TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.htmlspecialchars($buy_offer['name']).'</b> added to player <b>'.htmlspecialchars($buy_player->getName()).'</b> items (he will get this container with items after relog) for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br /><a href="?subtopic=shopsystem">GO TO MAIN SHOP SITE</a></TD></TR>
  592. </table>';
  593. }
  594. }
  595. else
  596. {
  597. $set_session = TRUE;
  598. $_SESSION['viewed_confirmation_page'] = 'yes';
  599. $main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%">
  600. <tr bgcolor="'.$config['site']['vdarkborder'].'"><td colspan="3" class="white"><b>Confirm Transaction</b></td></tr>
  601. <tr bgcolor="'.$config['site']['lightborder'].'"><td width="100"><b>Name:</b></td><td width="550" colspan="2">'. htmlspecialchars($buy_offer['name']).'</td></tr>
  602. <tr bgcolor="'.$config['site']['darkborder'].'"><td width="100"><b>Description:</b></td><td width="550" colspan="2">'. htmlspecialchars($buy_offer['description']).'</td></tr>
  603. <tr bgcolor="'.$config['site']['lightborder'].'"><td width="100"><b>Cost:</b></td><td width="550" colspan="2"><b>'. htmlspecialchars($buy_offer['points']).' premium points</b> from your account</td></tr>
  604. <tr bgcolor="'.$config['site']['darkborder'].'"><td width="100"><b>For Player:</b></td><td width="550" colspan="2"><font color="red">'.htmlspecialchars($buy_player->getName()).'</font></td></tr>
  605. <tr bgcolor="'.$config['site']['lightborder'].'"><td width="100"><b>From:</b></td><td width="550" colspan="2"><font color="red">'.htmlspecialchars($buy_from).'</font></td></tr>
  606. <tr bgcolor="'.$config['site']['darkborder'].'"><td colspan="3"></td></tr>
  607. <tr bgcolor="'.$config['site']['darkborder'].'"><td width="100"><b>Transaction?</b></td><td width="275" align="left">
  608. <form action="?subtopic=shopsystem&action=confirm_transaction" method="POST"><input type="hidden" name="buy_confirmed" value="yes"><input type="hidden" name="buy_id" value="'.$buy_id.'"><input type="hidden" name="buy_from" value="'.htmlspecialchars($buy_from).'"><input type="hidden" name="buy_name" value="'.htmlspecialchars($buy_name).'"><input type="submit" value="Accept"></form></td>
  609. <td align="right"><form action="?subtopic=shopsystem" method="POST"><input type="submit" value="Cancel"></form></td></tr>
  610. <tr bgcolor="'.$config['site']['darkborder'].'"><td colspan="3"></td></tr>
  611. </table>
  612. ';
  613. }
  614. }
  615. else
  616. {
  617. $errormessage .= 'Player with name <b>'.htmlspecialchars($buy_name).'</b> doesn\'t exist. Please <a href="?subtopic=shopsystem&action=select_player&buy_id='.$buy_id.'">select other name</a>.';
  618. }
  619. }
  620. else
  621. {
  622. $errormessage .= 'Invalid name format. Please <a href="?subtopic=shopsystem&action=select_player&buy_id='.$buy_id.'">select other name</a> or contact with administrator.';
  623. }
  624. }
  625. else
  626. {
  627. $errormessage .= 'For this item you need <b>'.$buy_offer['points'].'</b> points. You have only <b>'.$user_premium_points.'</b> premium points. Please <a href="?subtopic=shopsystem">select other item</a> or buy premium points.';
  628. }
  629. }
  630. else
  631. {
  632. $errormessage .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please <a href="?subtopic=shopsystem">select item</a> again.';
  633. }
  634. }
  635. }
  636. }
  637. if(!empty($errormessage))
  638. {
  639. $main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  640. <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Informations</B></TD></TR>
  641. <TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.$errormessage.'</b></TD></TR>
  642. </table>';
  643. }
  644. if(!$set_session)
  645. {
  646. unset($_SESSION['viewed_confirmation_page']);
  647. }
  648. }
  649. elseif($action == 'show_history')
  650. {
  651. if(!$logged)
  652. {
  653. $errormessage .= 'Please login first.';
  654. }
  655. else
  656. {
  657. $items_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_item').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';');
  658. if(is_object($items_history_received))
  659. {
  660. foreach($items_history_received as $item_received)
  661. {
  662. if($account_logged->getId() == $item_received['to_account'])
  663. $char_color = 'green';
  664. else
  665. $char_color = 'red';
  666. $items_received_text .= '<tr bgcolor="'.$config['site']['lightborder'].'"><td><font color="'.$char_color.'">'.htmlspecialchars($item_received['to_name']).'</font></td><td>';
  667. if($account_logged->getId() == $item_received['from_account'])
  668. $items_received_text .= '<i>Your account</i>';
  669. else
  670. $items_received_text .= htmlspecialchars($item_received['from_nick']);
  671. $items_received_text .= '</td><td>'.htmlspecialchars($item_received['offer_id']).'</td><td>'.date("j F Y, H:i:s", $item_received['trans_start']).'</td>';
  672. if($item_received['trans_real'] > 0)
  673. $items_received_text .= '<td>'.date("j F Y, H:i:s", $item_received['trans_real']).'</td>';
  674. else
  675. $items_received_text .= '<td><b><font color="red">Not realized yet.</font></b></td>';
  676. $items_received_text .= '</tr>';
  677. }
  678. }
  679. $main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  680. <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'"></TD></TR>
  681. <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><center><B>Transactions History</B></center></TD></TR>
  682. <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'"></TD></TR>
  683. </table><br>';
  684.  
  685. if(!empty($items_received_text))
  686. {
  687. $main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  688. <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white colspan="5"><B>Item Transactions</B></TD></TR>
  689. <tr bgcolor="'.$config['site']['darkborder'].'"><td><b>To:</b></td><td><b>From:</b></td><td><b>Offer name</b></td><td><b>Bought on page</b></td><td><b>Received on OTS</b></td></tr>
  690. '.$items_received_text.'
  691. </table><br />';
  692. }
  693. if(empty($items_received_text))
  694. $errormessage .= 'You did not buy/receive any item.';
  695. }
  696. if(!empty($errormessage))
  697. {
  698. $main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  699. <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Informations</B></TD></TR>
  700. <TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b>'.$errormessage.'</b></TD></TR>
  701. </table>';
  702. }
  703. }
  704. $main_content .= '<br><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  705. <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=left CLASS=white><B>Premium Points</B></TD></TR>
  706. <TR><TD BGCOLOR="'.$config['site']['lightborder'].'" ALIGN=left><b><font color="green">You have premium points: </font></b>'.$user_premium_points.'</TD></TR>
  707. </table>';
  708. }
  709. else
  710. $main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
  711. <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" ALIGN=center CLASS=white ><B>Shop Information</B></TD></TR>
  712. <TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><center>Shop is currently closed. [to admin: edit it in \'config/config.php\']</TD></TR>
  713. </table>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement