root/dev/mods/rank_mod/settings.php @ 491

Revision 370, 30.3 KB (checked in by kovell, 11 years ago)

- SQL queries optimised for speed and error protection.
- feed syndication optimised
- front page includes optional clock and optional kill/loss display
- mysqli support added
- transaction protection of kills added where supported (mysqli and InnoDB)
- summary tables and contracts show total destroyed value instead of ship value
- html errors reduced
- related kill calculation improved
- query caching errors reduced
- minor bugfixes
- Smarty 2.6.25 added
- apoc fitting mod added and modded
- code optimisations
- code comments added (doxygen format)
- conflicting mods are now identified

Line 
1<?php
2require_once("common/admin/admin_menu.php");
3require_once('common/includes/class.toplist.php');
4require_once('mods/rank_mod/settings_defines.php');
5require_once('mods/rank_mod/settings_shipclasses.php');
6
7$rank_ver = '0.97c';
8
9// CHANGE TITLES & ABBREVIATIONS
10
11if ($_POST['change'])
12{
13        $html .= "<b>Titles Changed</b>";
14}
15
16// SAVE SETTINGS
17
18if ($_POST['submit'])
19{
20        // prepare rank show data
21        $data .= "-";
22        if($_POST['r_ins']) {$data .="rank-";}
23        if($_POST['r_med']) {$data .="medal-";}
24        if($_POST['r_medrib']) {$data .="nomeds-";}             
25        if($_POST['r_bad']) {$data .="badge-";}
26        if($_POST['r_case']) {$data .="case-";}
27        if($_POST['rkd_base']) {$data .="base-";}
28        if($_POST['rkd_bonus']) {$data .="bonus-";}     
29        if($_POST['rkd_total']) {$data .="total-";}     
30        config::set('rankmod_show', $data);
31
32        // prepare known members data
33        $data .= "-";
34        if($_POST['k_on']) {$data .="enabled-";}
35        if($_POST['k_img']) {$data .="portrait-";}
36        if($_POST['k_kll_pnts']) {$data .="score-";}           
37        if($_POST['k_dmg_dn']) {$data .="done-";}
38        if($_POST['k_dmg_rcd']) {$data .="received-";}
39        if($_POST['k_kll_rat']) {$data .="ratio-";}     
40        if($_POST['k_eff']) {$data .="efficiency-";}   
41        if($_POST['k_lst_sn']) {$data .="last_seen-";} 
42        config::set('rankmod_known', $data);
43
44        // set rank base data
45        config::set('rankmod_expfactor',$_POST['r_exp']);
46        config::set('rankmod_expbase',$_POST['r_base']);
47        config::set('rankmod_convfactor',$_POST['r_conv']);
48       
49        // set medals bonuses
50        $r_medval=array();
51        foreach ($medals_array as $i => $med) {
52                $r_medval[$i]=$_POST['rm_'.$i];
53        }
54        config::set('rankmod_bonus',$r_medval);
55        if($_POST['pm_neg']) {
56          config::set('rankmod_purplemalus',TRUE);
57        } else {
58          config::set('rankmod_purplemalus',FALSE);
59        }
60
61        // set parent ship bonuses & requirements
62        $r_badval=array();
63        $r_badreq=array();
64        foreach ($ribbon_parent as $i => $class) {
65                $r_badreq[$i][0]=$_POST['rsc_'.$i.'_elite'];
66                $r_badval[$i][0]=$_POST['rsc_'.$i.'_belite'];
67                $r_badreq[$i][1]=$_POST['rsc_'.$i.'_veteran'];
68                $r_badval[$i][1]=$_POST['rsc_'.$i.'_bveteran'];
69                $r_badreq[$i][2]=$_POST['rsc_'.$i.'_expert'];
70                $r_badval[$i][2]=$_POST['rsc_'.$i.'_bexpert'];
71        }
72        config::set('rankmod_badreqs',$r_badreq);
73        config::set('rankmod_badvalues',$r_badval);
74
75        // set subclass ship bonuses & requirements
76        $r_sub_badval=array();
77        $r_sub_badreq=array();
78        $data="-";
79        foreach ($ribbon_child as $i => $ship) {
80                $class=$ship['class'];
81                $r_sub_badreq[$i][0]=$_POST['rsbc_'.$i.'_elite'];
82                $r_sub_badval[$i][0]=$_POST['rsbc_'.$i.'_belite'];
83                $r_sub_badreq[$i][1]=$_POST['rsbc_'.$i.'_veteran'];
84                $r_sub_badval[$i][1]=$_POST['rsbc_'.$i.'_bveteran'];
85                $r_sub_badreq[$i][2]=$_POST['rsbc_'.$i.'_expert'];
86                $r_sub_badval[$i][2]=$_POST['rsbc_'.$i.'_bexpert'];
87                if ($_POST['enable_'.$i]) { $data .=$class."-"; }
88        }
89        config::set('rankmod_sub_badreqs',$r_sub_badreq);
90        config::set('rankmod_sub_badvalues',$r_sub_badval);
91        config::set('rankmod_enables',$data);
92       
93        // set weapon bonuses & requirements
94        $r_wbadval=array();
95        $r_wbadreq=array();
96        foreach ($weapon_ribbons_array as $i => $class) {
97                $r_wbadreq[$i][0]=$_POST['rwr_'.$i.'_elite'];
98                $r_wbadval[$i][0]=$_POST['rwr_'.$i.'_belite'];
99                $r_wbadreq[$i][1]=$_POST['rwr_'.$i.'_veteran'];
100                $r_wbadval[$i][1]=$_POST['rwr_'.$i.'_bveteran'];
101                $r_wbadreq[$i][2]=$_POST['rwr_'.$i.'_expert'];
102                $r_wbadval[$i][2]=$_POST['rwr_'.$i.'_bexpert'];
103        }
104        config::set('rankmod_weapreqs',$r_wbadreq);
105        config::set('rankmod_weapvalues',$r_wbadval);
106
107        // set rank titles & images
108
109        switch($_POST['r_group']) {
110                case "Enlisted": $a_s = 0; $a_l = 10; 
111                break;
112                case "Officer": $a_s = 10; $a_l = 21;
113                break;
114                case "Enlisted + Officer": $a_s = 0; $a_l = 21;
115                break;
116        }
117        $ranklist=array();
118        $blankimg = IMG_URL.'/ranks/insignias/army_en0.png';
119        $r = 0;
120        $uniserv='enlisted';
121        for ($i = $a_s; $i<$a_l; $i++) {
122          $j = $i*2;
123          $k = $j+1;
124          if ($i==10) {$uniserv = 'officer';}
125          if ($uniserv == 'officer') { $m = $i - 10; } else { $m = $i; }
126          if ($_POST['k_title']) {
127            $ranktitle= $_POST['title_'.$r];
128            $rankabbr= $_POST['abbr_'.$r];
129          } else {     
130            $ranktitle= ${$s_rank_specs[$_POST['r_titleset']]['title']}[$j];
131            $rankabbr= ${$s_rank_specs[$_POST['r_titleset']]['title']}[$k];
132          }
133          $imglink = 'ranks/insignias/'.$s_rank_specs[$_POST['r_imageset']][$uniserv].$m.'.png';
134          $imgtemp = IMG_URL.'/'.$imglink;
135          $smarty->assign('img', $imgtemp);
136          $smarty->assign('icon', $blankimg);
137          $smarty->assign('name', $ranktitle);
138          $img = $smarty->fetch(get_tpl('icon32'));
139          $ranklist[]=array('title' => $ranktitle, 'abbr' => $rankabbr, 'img' => $img, 'reqrp' => 0, 'reqkp' => 0, 'imglink' => $imglink);
140          $r++;
141        }
142        for ($i=0; $i<$r; $i++)
143        {
144                $rps = ($i*$_POST['r_base'])+round($ranklist[$i-1]['reqrp']*$_POST['r_exp']);
145                $kps = $rps*$_POST['r_conv'];
146                $ranklist[$i]['reqrp'] = $rps;
147                $ranklist[$i]['reqkp'] = $kps;
148        }
149        config::set('rankmod_titles',$ranklist);
150
151        if($_POST['k_title']) {
152          config::set('rankmod_keep',TRUE);
153        } else {
154          config::set('rankmod_keep',FALSE);
155        }
156        config::set('rankmod_rtype',$_POST['r_group']);
157        config::set('rankmod_imageset', $_POST['r_imageset']);
158        config::set('rankmod_titleset', $_POST['r_titleset']);
159
160        $html .= "<b>Settings Saved</b>";
161}
162
163// MEDAL TABLE CTREATION
164
165if ($_POST['drop_tabs'])
166{
167  config::set('rank_last_update',0);
168  $nqry = new DBNormalQuery();
169  $query = 'DROP TABLE `kb3_rank_medals`';
170  $nqry->execute($query);
171  $html .= "<b>MEDAL TABLE DROPPED - PLEASE RECREATE</b>";
172}
173
174if ($_POST['create_tabs'])
175{
176  $curr_kb_year = kbdate('Y');
177  $curr_kb_month = kbdate('m') - 1;
178  if ($curr_kb_month == 0) {
179    $curr_kb_month = 12;
180    $curr_kb_year--;
181  }
182  $month = $_POST['kb_startm'];
183  $year = $_POST['kb_starty'];
184  if ($year==$curr_kb_year && $month>$curr_kb_month) {
185    $html .= "<b>ERROR: </b><i>Wrong date, check start month!</i><br>";
186    $html .= "<b>Tables NOT Created</b>";
187  } elseif ($year>$curr_kb_year) {
188    $html .= "<b>ERROR: </b><i>Wrong date, check start year!</i><br>";
189    $html .= "<b>Tables NOT Created</b>";
190  } else {
191    $qry = new DBQuery();
192    if (!config::get('rank_last_update')) {
193      $query = 'CREATE TABLE `kb3_rank_medals` (
194          `med_site` varchar(16) NOT NULL ,       
195          `plt_id` INT NOT NULL ,
196          `med_id` INT NOT NULL ,
197          `time_id` TEXT NOT NULL
198          ) TYPE = MYISAM';
199      $qry->execute($query);   
200      $upd .= "".$curr_kb_year." - ".$curr_kb_month;
201      config::set('rank_last_update',$upd);
202    } else {
203      $nqry = new DBNormalQuery();
204      $query = "DELETE FROM kb3_rank_medals WHERE med_site = '".KB_SITE."'";
205      $nqry->execute($query); 
206      $upd .= "".$curr_kb_year." - ".$curr_kb_month;
207      config::set('rank_last_update',$upd); 
208    }
209    while ($year<=$curr_kb_year) {
210      while (($month<=$curr_kb_month && $year==$curr_kb_year) || ($month<=12 && $year!=$curr_kb_year)) {
211          if ($month < 10) { $p_month = "0".$month; } else { $p_month = $month; }
212          $date = "".$year." - ".$p_month;
213
214          $list = new TopKillsList();
215          $list->setMonth($month);
216          $list->setYear($year);
217          $list->setPodsNoobShips(true);
218          involved::load($list,'kill');
219          $list->generate();
220          if ($row = $list->getRow()) {
221             $html .= "Top Killer ".$date."<br>";
222             $query = "INSERT INTO kb3_rank_medals (med_site, plt_id, med_id, time_id) VALUES ('".KB_SITE."', '".$row['plt_id']."', '0','".$date."');";
223             $qry->execute($query);
224          }
225          $list = new TopScoreList();
226          $list->setMonth($month);
227          $list->setYear($year);
228          $list->setPodsNoobShips(true);
229          involved::load($list,'kill');
230          $list->generate();
231          if ($row = $list->getRow()) {
232             $html .= "Top Scorer ".$date."<br>";
233             $query = "INSERT INTO kb3_rank_medals (med_site, plt_id, med_id, time_id) VALUES ('".KB_SITE."', '".$row['plt_id']."', '1','".$date."');";
234             $qry->execute($query);
235          }
236          $list = new TopSoloKillerList();
237          $list->setMonth($month);
238          $list->setYear($year);
239          $list->setPodsNoobShips(true);
240          involved::load($list,'kill');
241          $list->generate();
242          if ($row = $list->getRow()) {
243             $html .= "Top Solo Killer ".$date."<br>";
244             $query = "INSERT INTO kb3_rank_medals (med_site, plt_id, med_id, time_id) VALUES ('".KB_SITE."', '".$row['plt_id']."', '2','".$date."');";
245             $qry->execute($query);
246          }
247          $list = new TopDamageDealerList();
248          $list->setMonth($month);
249          $list->setYear($year);
250          $list->setPodsNoobShips(true);
251          involved::load($list,'kill');
252          $list->generate();
253          if ($row = $list->getRow()) {
254             $html .= "Top Damagedealer ".$date."<br>";;
255             $query = "INSERT INTO kb3_rank_medals (med_site, plt_id, med_id, time_id) VALUES ('".KB_SITE."', '".$row['plt_id']."', '3','".$date."');";
256             $qry->execute($query);
257          }
258          $list = new TopFinalBlowList();
259          $list->setMonth($month);
260          $list->setYear($year);
261          $list->setPodsNoobShips(true);
262          involved::load($list,'kill');
263          $list->generate();
264          if ($row = $list->getRow()) {
265             $html .= "Top Final Blower ".$date."<br>";;
266             $query = "INSERT INTO kb3_rank_medals (med_site, plt_id, med_id, time_id) VALUES ('".KB_SITE."', '".$row['plt_id']."', '4','".$date."');";
267             $qry->execute($query);
268          }
269          $list = new TopPodKillerList();
270          $list->setMonth($month);
271          $list->setYear($year);
272          $list->setPodsNoobShips(true);
273          involved::load($list,'kill');
274          $list->generate();
275          if ($row = $list->getRow()) {
276             $html .= "Top Pod Killer ".$date."<br>";;
277             $query = "INSERT INTO kb3_rank_medals (med_site, plt_id, med_id, time_id) VALUES ('".KB_SITE."', '".$row['plt_id']."', '5','".$date."');";
278             $qry->execute($query);
279          }
280          $list = new TopGrieferList();
281          $list->setMonth($month);
282          $list->setYear($year);
283          $list->setPodsNoobShips(true);
284          involved::load($list,'kill');
285          $list->generate();
286          if ($row = $list->getRow()) {
287             $html .= "Top Griefer ".$date."<br>";;
288             $query = "INSERT INTO kb3_rank_medals (med_site, plt_id, med_id, time_id) VALUES ('".KB_SITE."', '".$row['plt_id']."', '6','".$date."');";
289             $qry->execute($query);
290          }
291          $list = new TopCapitalShipKillerList();
292          $list->setMonth($month);
293          $list->setYear($year);
294          $list->setPodsNoobShips(true);
295          involved::load($list,'kill');
296          $list->generate();
297          if ($row = $list->getRow()) {
298             $html .= "Top ISK Killer ".$date."<br>";;
299             $query = "INSERT INTO kb3_rank_medals (med_site, plt_id, med_id, time_id) VALUES ('".KB_SITE."', '".$row['plt_id']."', '7','".$date."');";
300             $qry->execute($query);
301          }
302          $list = new TopLossesList();
303          $list->setMonth($month);
304          $list->setYear($year);
305          $list->setPodsNoobShips(true);
306          involved::load($list,'loss');
307          $list->generate();
308          if ($row = $list->getRow()) {
309             $html .= "Top Loser ".$date."<br>";;
310             $query = "INSERT INTO kb3_rank_medals (med_site, plt_id, med_id, time_id) VALUES ('".KB_SITE."', '".$row['plt_id']."', '8','".$date."');";
311             $qry->execute($query);
312          }
313          $month++;
314      }
315      $year++;
316      $month = 1;
317    }
318    $html .= "<b>Tables Created</b>";
319  }
320}
321
322$page = new Page("Settings - Rank Mod ".$rank_ver);
323
324$rank_imageset = config::get('rankmod_imageset'); // insignia image set
325$rank_titleset = config::get('rankmod_titleset'); // title set
326$keep_title = config::get('rankmod_keep'); // remember keep titles
327
328$rank_type = config::get('rankmod_rtype'); // type of ranks (Enlisted, Officer, Enlisted + Officer)
329if (!($rank_type)) { $rank_type = 'Officer'; }
330
331$rank_ef = config::get('rankmod_expfactor'); // exp factor (1, 1.2, 1.5, 1.7, 2, 2.5)
332if (!($rank_ef)) { $rank_ef = 1.2; }
333
334$rank_base = config::get('rankmod_expbase'); // base value (amount of rank points to go to next level)
335if (!($rank_base)) { $rank_base = 25; }
336
337$rank_conv = config::get('rankmod_convfactor'); // conversion factor (every how much killpoints gets a rank point)
338if (!($rank_conv)) { $rank_conv = 50; }
339
340$rank_badges = config::getnumerical('rankmod_badreqs'); // requirements for badges level (expert, veteran, elite)
341if (!($rank_badges)) { $rank_badges = array(10, 25, 40); }
342
343$rank_bonus = config::getnumerical('rankmod_badvalues'); // value for badges level (expert, veteran, elite)
344if (!($rank_bonus)) { $rank_bonus = array(25, 50, 100); }
345
346$rank_weap_badges = config::getnumerical('rankmod_weapreqs'); // requirements for badges level (expert, veteran, elite)
347if (!($rank_badges)) { $rank_badges = array(10, 25, 40); }
348
349$rank_weap_bonus = config::getnumerical('rankmod_weapvalues'); // value for badges level (expert, veteran, elite)
350if (!($rank_bonus)) { $rank_bonus = array(25, 50, 100); }
351
352$rank_sub_badges = config::getnumerical('rankmod_sub_badreqs'); // requirements for badges level (expert, veteran, elite)
353if (!($rank_sub_badges)) { $rank_badges = array(10, 25, 40); }
354
355$rank_sub_bonus = config::getnumerical('rankmod_sub_badvalues'); // value for badges level (expert, veteran, elite)
356if (!($rank_sub_bonus)) { $rank_sub_bonus = array(25, 50, 100); }
357
358
359$rank_medvalues = config::getnumerical('rankmod_bonus'); // bonus for each awarded medal
360if (!($rank_medalbonus)) { $rank_medalbonus = 50; }
361
362$rank_show = config::get('rankmod_show'); // Show images in the portrait (rank, medals, badges)
363if (!($rank_show)) { $rank_show = "-rank-medal-badge-base-case-bonus-total-nomeds"; }
364
365$rank_known = config::get('rankmod_known'); // Show Known Members Mod
366if (!($rank_known)) { $rank_known = "-enabled-portrait-score-done-received-ratio-efficiency-last_seen-"; }
367
368$rank_last_update = config::get('rank_last_update'); // gets last update of the medals table
369if (!($rank_last_update)) {$rank_last_update="NEVER - Please check tables"; }
370
371$rank_ttl = config::getnumerical('rankmod_titles'); // titles array (array of arrays containing title,abbr,img,reqrp,reqkp)
372if (!($rank_ttl)) { $rank_ttl = array( array('title' => 'SAVE SETTINGS'));}
373
374$rank_purplemalus = config::get('rankmod_purplemalus'); // count purple moon as a bonus or a malus
375
376$rank_subenabled=config::get('rankmod_enables');
377
378$curr_kb_year = kbdate('Y');
379$curr_kb_month = kbdate('m') - 1;
380if ($curr_kb_month == 0) {
381  $curr_kb_month = 12;
382  $curr_kb_year--;
383}
384
385$html .= "<form id=options name=options method=post action=>";
386
387// BEGIN table options
388$html .= "<div class=block-header2>Medal Table Generation</div>";
389$html .= "<i>Prepares medal table on the database.</i><br>";
390$html .= "<i>This is required to make load faster pilot details page.</i><br>";
391$html .= "<i>Please note that saving changes will NOT check tables, use the button here instead!</i><br>";
392$html .= "<i>When pressed please wait, because it can take a bit longer, it does 9 querys per month, and 108 per year...</i><br><br>";
393$html .= "<table class=kb-table width=\"360\" border=\"0\" cellspacing=\"1\">";
394$html .= "<tr><td width=300><b>Select Start Year:</b></td><td>";
395$html .= '<select name="kb_starty">';
396foreach($kb_year as $kby)
397{
398        $html .='<option value="'.$kby.'"';
399        if($kby == $curr_kb_year)
400                {
401                        $html .= ' selected="selected"';
402                }
403        $html .='>'.$kby.'</option>';
404}
405$html .= "</select></td></tr>";
406$html .= "<tr><td width=300><b>Select Start Month:</b></td><td>";
407$html .= '<select name="kb_startm">';
408foreach($kb_month as $kbm)
409{
410        $html .='<option value="'.$kbm.'"';
411        if($kby == $curr_kb_month)
412                {
413                        $html .= ' selected="selected"';
414                }
415        $html .='>'.$kbm.'</option>';
416}
417$html .= "</select></td></tr>";
418$html .= "<tr><td><b>Last Update:</b></td><td>".$rank_last_update."</td></tr>";
419$html .= "</table>";
420$html .= "<table class=kb-subtable><tr><td width=120><input type=submit name=drop_tabs value=\"Drop Table\"></td><td colspan=3 ><input type=submit name=create_tabs value=\"Check Table\"></td></tr>";
421$html .= "</table>";
422// END table options
423
424// BEGIN general options
425$html .= "<div class=block-header2>General Options</div>";
426
427// Known Members section
428$html .= "<i>Add data to rank list and known members list.</i><br><br>";
429$html .= "<table class=kb-table width=\"360\" border=\"0\" cellspacing=\"1\">";
430$html .= "<tr><td><b>Enable Known Members:</b></td><td><input type=checkbox name=k_on id=k_on";
431if (strpos($rank_known,"enabled"))
432{
433    $html .= " checked=\"checked\"";
434}
435$html .= "></td></tr>";
436$html .= "<tr><td><b>Add Char. Portrait:</b></td><td><input type=checkbox name=k_img id=k_img";
437if (strpos($rank_known,"portrait"))
438{
439    $html .= " checked=\"checked\"";
440}
441$html .= "></td></tr>";
442$html .= "<tr><td><b>Add Kill Points:</b></td><td><input type=checkbox name=k_kll_pnts id=k_kll_pnts";
443if (strpos($rank_known,"score"))
444{
445    $html .= " checked=\"checked\"";
446}
447$html .= "></td></tr>";
448$html .= "<tr><td><b>Add Damage Done:</b></td><td><input type=checkbox name=k_dmg_dn id=k_dmg_dn";
449if (strpos($rank_known,"done"))
450{
451    $html .= " checked=\"checked\"";
452}
453$html .= "></td></tr>";
454$html .= "<tr><td><b>Add Damage Received:</b></td><td><input type=checkbox name=k_dmg_rcd id=k_dmg_rcd";
455if (strpos($rank_known,"received"))
456{
457    $html .= " checked=\"checked\"";
458}
459$html .= "></td></tr>";
460$html .= "<tr><td><b>Add Kill Ratio:</b></td><td><input type=checkbox name=k_kll_rat id=k_kll_rat";
461if (strpos($rank_known,"ratio"))
462{
463    $html .= " checked=\"checked\"";
464}
465$html .= "></td></tr>";
466
467$html .= "<tr><td><b>Add Efficency:</b></td><td><input type=checkbox name=k_eff id=k_eff";
468if (strpos($rank_known,"efficiency"))
469{
470    $html .= " checked=\"checked\"";
471}
472$html .= "></td></tr>";
473$html .= "<tr><td><b>Add Last Seen In:</b></td><td><input type=checkbox name=k_lst_sn id=k_lst_sn";
474if (strpos($rank_known,"last_seen"))
475{
476    $html .= " checked=\"checked\"";
477}
478$html .= "></td></tr>";
479
480$html .= "</table><br>";
481
482// Portrait section
483$html .= "<i>Show icons on player portrait.</i><br><br>";
484$html .= "<table class=kb-table width=\"360\" border=\"0\" cellspacing=\"1\">";
485$html .= "<tr><td><b>Show Rank Insigna:</b></td><td><input type=checkbox name=r_ins id=r_ins";
486if (strpos($rank_show,"rank"))
487{
488    $html .= " checked=\"checked\"";
489}
490$html .= "></td></tr>";
491$html .= "<tr><td><b>Show Medals:</b></td><td><input type=checkbox name=r_med id=r_med";
492if (strpos($rank_show,"medal"))
493{
494    $html .= " checked=\"checked\"";
495}
496$html .= "></td></tr>";
497$html .= "<tr><td><b>Show Medals as Ribbons:</b></td><td><input type=checkbox name=r_medrib id=r_medrib";
498if (strpos($rank_show,"nomeds"))
499{
500    $html .= " checked=\"checked\"";
501}
502$html .= "></td></tr>";
503$html .= "<tr><td width=300><b>Show Ribbons:</b></td><td><input type=checkbox name=r_bad id=r_bad";
504if (strpos($rank_show,"badge"))
505{
506    $html .= " checked=\"checked\"";
507}
508$html .= "></td></tr></table><br>";
509
510// Small showcase
511$html .= "<i>Adds a small showcase under pilot data showing all of above.</i><br>";
512$html .= "<i>Please note that if this option is enabled the rank will be still in the portrait.</i><br><br>";
513$html .= "<table class=kb-table width=\"360\" border=\"0\" cellspacing=\"1\">";
514$html .= "<tr><td><b>Add Small Showcase:</b></td><td><input type=checkbox name=r_case id=r_case";
515if (strpos($rank_show,"case"))
516{
517    $html .= " checked=\"checked\"";
518}
519$html .= "></td></tr></table><br>";
520
521// Pilot detail section
522$html .= "<i>Show rank score on Pilot Details page.</i><br><br>";
523$html .= "<table class=kb-table width=\"360\" border=\"0\" cellspacing=\"1\">";
524$html .= "<tr><td><b>Show Base Rank Points:</b></td><td><input type=checkbox name=rkd_base id=rkd_base";
525if (strpos($rank_show,"base"))
526{
527    $html .= " checked=\"checked\"";
528}
529$html .= "></td></tr>";
530$html .= "<tr><td><b>Show Bonus Rank Points:</b></td><td><input type=checkbox name=rkd_bonus id=rkd_bonus";
531if (strpos($rank_show,"bonus"))
532{
533    $html .= " checked=\"checked\"";
534}
535$html .= "></td></tr>";
536$html .= "<tr><td width=300><b>Show Total Rank Points:</b></td><td><input type=checkbox name=rkd_total id=rkd_total";
537if (strpos($rank_show,"total"))
538{
539    $html .= " checked=\"checked\"";
540}
541$html .= "></td></tr></table><br>";
542// END general options
543
544// BEGIN rank options
545$html .= "<div class=block-header2>Rank Options</div>";
546$html .= "<i>Select images and names for the rank list.</i><br><br>";
547$html .= "<table class=kb-table width=\"360\" border=\"0\" cellspacing=\"1\">";
548$html .= "<tr><td width=300><b>Rank Title Set:</b></td><td>";
549$html.='<select name="r_titleset">';
550foreach($s_rank_titleset as $corp)
551{
552        $html .='<option value="'.$corp.'"';
553        if($corp == $rank_titleset)
554                {
555                        $html .= ' selected="selected"';
556                }
557        $html .='>'.$corp.'</option>';
558}
559$html .="</select></td></tr>";
560$html .= "<tr><td width=300><b>Rank Insignia Set:</b></td><td>";
561$html.='<select name="r_imageset">';
562foreach($s_rank_imageset as $corp)
563{
564        $html .='<option value="'.$corp.'"';
565        if($corp == $rank_imageset)
566                {
567                        $html .= ' selected="selected"';
568                }
569        $html .='>'.$corp.'</option>';
570}
571$html .="</select></td></tr>";
572
573$html .= "<tr><td width=300><b>Rank Group:</b></td><td width=60>";
574$html.='<select name="r_group">';
575foreach($s_rank_type as $rtype)
576{
577        $html .='<option value="'.$rtype.'"';
578        if($rtype == $rank_type)
579                {
580                        $html .= ' selected="selected"';
581                }
582        $html .='>'.$rtype.'</option>';
583}
584$html .="</select></td></tr></table>";
585// END rank options
586
587// BEGIN rank parameters
588$html .= "<div class=block-header2>Rank Parameters</div>";
589$html .= "<i>Parametes of the exp rank table.</i><br>";
590$html .= "<i>Required Rank Points = (Rank Position * Base Rank Points) + (Previous Rank Position Required Rank Points * Exponential Factor)</i><br>";
591$html .= "<i>Pilot Base Rank Points = Kill Points / Conversion Factor</i><br>";
592$html .= "<i>Total Pilot Rank Points = Pilot Base Rank Points + Ribbons Bonus Rank Points + Medals Bonus Rank Points</i><br><br>";
593$html .= "<table class=kb-table width=\"360\" border=\"0\" cellspacing=\"1\">";
594$html .= "<tr><td width=300><b>Exponential Factor:</b></td><td>";
595$html.='<select name="r_exp">';
596foreach($s_e_factor as $exp)
597{
598        $html .='<option value="'.$exp.'"';
599        if($exp == $rank_ef)
600                {
601                        $html .= ' selected="selected"';
602                }
603        $html .='>'.$exp.'</option>';
604}
605$html .="</select></td></tr>";
606
607$html .= "<tr><td width=300><b>Base Rank Points:</b></td><td>";
608$html.="<input type=text name=r_base size=4 maxlength=4 class=password value=\"" . $rank_base . "\"></td></tr>";
609
610$html .= "<tr><td width=300><b>Conversion Factor - Kill Points for 1 Rank Point:</b></td><td>";
611$html.="<input type=text name=r_conv size=4 maxlength=4 class=password value=\"" . $rank_conv . "\"></td></tr>";
612
613$html .= "</table>";
614// END rank parameters
615
616//BEGIN ribbon table
617$html .= "<div class=block-header2>Ship Ribbon Settings Table</div>";
618$html .= "<table class=kb-table width=\"750\" border=\"0\" cellspacing=\"1\">";
619$html .= "<tr class=kb-table-header><td colspan=2><b>Class</b><br><i>Subclass</i></td>";
620$html .= "<td align=center><b>Expert<br>Requirement</b></td><td align=center><b>Expert<br>Bonus</b></td>";
621$html .= "<td align=center><b>Veteran<br>Requirement</b></td><td align=center><b>Veteran<br>Bonus</b></td>";
622$html .= "<td align=center><b>Elite<br>Requirement</b></td><td align=center><b>Elite<br>Bonus</b></td></tr>";
623$row_class='odd';
624$k=0;
625foreach ($ribbon_parent as $i => $class) {
626  if ($row_class=='odd') {$row_class='even';} else {$row_class='odd';}
627  $html .= "<tr class=kb-table-row-".$row_class."><td colspan=2>".$class."</td>";
628  $html .= "<td align=center><input type=text name=rsc_".$i."_expert size=4 maxlength=4 class=password value=\"" . $rank_badges[$i][2] . "\"></td>";
629  $html .= "<td align=center><input type=text name=rsc_".$i."_bexpert size=4 maxlength=4 class=password value=\"" . $rank_bonus[$i][2] . "\"></td>";
630  $html .= "<td align=center><input type=text name=rsc_".$i."_veteran size=4 maxlength=4 class=password value=\"" . $rank_badges[$i][1] . "\"></td>";
631  $html .= "<td align=center><input type=text name=rsc_".$i."_bveteran size=4 maxlength=4 class=password value=\"" . $rank_bonus[$i][1] . "\"></td>";
632  $html .= "<td align=center><input type=text name=rsc_".$i."_elite size=4 maxlength=4 class=password value=\"" . $rank_badges[$i][0] . "\"></td>";
633  $html .= "<td align=center><input type=text name=rsc_".$i."_belite size=4 maxlength=4 class=password value=\"" . $rank_bonus[$i][0] . "\"></td>";
634  $html .= "</tr>";
635  foreach ($ribbon_child as $j => $subclass) {
636    if ($subclass['parent'] == $i) {
637    if ($row_class=='odd') {$row_class='even';} else {$row_class='odd';}
638    $html .= "<tr class=kb-table-row-".$row_class."><td><input type=checkbox name=enable_".$k." id=enable_".$k;
639    if (strpos($rank_subenabled, $subclass['class']))
640    {
641      $html .= " checked=\"checked\"";
642    }
643    $html .= "</td><td><i>".$subclass['class']."</i></td>";
644    $html .= "<td align=center><input type=text name=rsbc_".$k."_expert size=4 maxlength=4 class=password value=\"" . $rank_sub_badges[$k][2] . "\"></td>";
645    $html .= "<td align=center><input type=text name=rsbc_".$k."_bexpert size=4 maxlength=4 class=password value=\"" . $rank_sub_bonus[$k][2] . "\"></td>";
646    $html .= "<td align=center><input type=text name=rsbc_".$k."_veteran size=4 maxlength=4 class=password value=\"" . $rank_sub_badges[$k][1] . "\"></td>";
647    $html .= "<td align=center><input type=text name=rsbc_".$k."_bveteran size=4 maxlength=4 class=password value=\"" . $rank_sub_bonus[$k][1] . "\"></td>";
648    $html .= "<td align=center><input type=text name=rsbc_".$k."_elite size=4 maxlength=4 class=password value=\"" . $rank_sub_badges[$k][0] . "\"></td>";
649    $html .= "<td align=center><input type=text name=rsbc_".$k."_belite size=4 maxlength=4 class=password value=\"" . $rank_sub_bonus[$k][0] . "\"></td>";
650    $html .= "</tr>";
651    $k++;       
652    }
653  }
654}
655$html .= "</table><br>";
656//END ribbon table
657
658// WEAPON RIBBON table
659
660$html .= "<div class=block-header2>Weapon Ribbon Settings Table</div>";
661$html .= "<table class=kb-table width=\"750\" border=\"0\" cellspacing=\"1\">";
662$html .= "<tr class=kb-table-header><td align=center>Class</td>";
663$html .= "<td align=center><b>Expert<br>Requirement</b></td><td align=center><b>Expert<br>Bonus</b></td>";
664$html .= "<td align=center><b>Veteran<br>Requirement</b></td><td align=center><b>Veteran<br>Bonus</b></td>";
665$html .= "<td align=center><b>Elite<br>Requirement</b></td><td align=center><b>Elite<br>Bonus</b></td></tr>";
666$row_class='odd';
667foreach ($weapon_ribbons_array as $i => $class) {
668  if ($row_class=='odd') {$row_class='even';} else {$row_class='odd';}
669  $html .= "<tr class=kb-table-row-".$row_class."><td>".$class."</td>";
670  $html .= "<td align=center><input type=text name=rwr_".$i."_expert size=4 maxlength=4 class=password value=\"" . $rank_weap_badges[$i][2] . "\"></td>";
671  $html .= "<td align=center><input type=text name=rwr_".$i."_bexpert size=4 maxlength=4 class=password value=\"" . $rank_weap_bonus[$i][2] . "\"></td>";
672  $html .= "<td align=center><input type=text name=rwr_".$i."_veteran size=4 maxlength=4 class=password value=\"" . $rank_weap_badges[$i][1] . "\"></td>";
673  $html .= "<td align=center><input type=text name=rwr_".$i."_bveteran size=4 maxlength=4 class=password value=\"" . $rank_weap_bonus[$i][1] . "\"></td>";
674  $html .= "<td align=center><input type=text name=rwr_".$i."_elite size=4 maxlength=4 class=password value=\"" . $rank_weap_badges[$i][0] . "\"></td>";
675  $html .= "<td align=center><input type=text name=rwr_".$i."_belite size=4 maxlength=4 class=password value=\"" . $rank_weap_bonus[$i][0] . "\"></td>";
676  $html .= "</tr>";
677}
678$html .= "</table><br>";
679
680// END WEAPON RIBBON TABLE
681
682// BEGIN medal table
683$html .= "<div class=block-header2>Medal Settings Table</div>";
684$html .= "<table class=kb-table width=\"50%\" border=\"0\" cellspacing=\"1\">";
685$html .= "<tr class=kb-table-header><td width=\"50%\">Class</td>";
686$html .= "<td align=center>Value</td></tr>";
687$row_class='odd';
688foreach ($medals_array as $i => $med) {
689  if ($row_class=='odd') {$row_class='even';} else {$row_class='odd';}
690  $html .= "<tr class=kb-table-row-".$row_class."><td>".$med."</td>";
691  $html .= "<td align=center><input type=text name=rm_".$i." size=4 maxlength=4 class=password value=\"" . $rank_medvalues[$i] . "\"></td></tr>";
692}
693$html .= "</table><br>";
694// END medal table
695
696// Top loser negative
697$html .= "<table class=kb-table width=\"360\" border=\"0\" cellspacing=\"1\">";
698$html .= "<tr><td><b>Count Top Loser as a negative value:</b></td><td><input type=checkbox name=pm_neg id=pm_neg";
699if ($rank_purplemalus)
700{
701    $html .= " checked=\"checked\"";
702}
703$html .= "></td></tr>";
704$html .= "</table><br>";
705// END top loser
706
707// Show ranks thingy
708if ($keep_title) { $words = 'Custom Rank Set'; } else { $words = $rank_titleset." Rank Set"; }
709$html .= "<div class=block-header2>Rank Evolution Table - ".$words." with ".$rank_imageset." Insignia Set - ".$rank_type."</div>";
710$html .= "<i>Prevents to rename custom titles and abbreviations.</i><br>";
711$html .= "<i>Use it only if you modify only settings and keep lenght of the table intact.</i><br><br>";
712$html .= "<table class=kb-table width=\"360\" border=\"0\" cellspacing=\"1\">";
713$html .= "<tr><td><b>Enable Custom Titles:</b></td><td><input type=checkbox name=k_title id=k_title";
714if ($keep_title)
715{
716    $html .= " checked=\"checked\"";
717}
718$html .= "></td></tr></table><br>";
719$html .= "<table class=kb-table width=\"750\" border=\"0\" cellspacing=\"1\">";
720$html .= "<tr><td width=34><b>Icon</b></td><td width=266><b>Rank Name</b></td><td width=150><b>Abbreviation</b></td><td width=150><b>Req. Rank Points</b></td><td width=150><b>Req. Kill Points</b></td></tr>";
721foreach($rank_ttl as $i => $level) {
722  $html .= "<tr height=36><td class=\"item-icon\" valign=\"top\" width=\"34\" height=\"36\">".$level['img']."</td>";   
723  $html .= "<td><input type=text name=title_".$i." size=50 maxlength=50 class=password value=\"" . $level['title'] . "\"></td>";
724  $html .= "<td><input type=text name=abbr_".$i." size=8 maxlength=8 class=password value=\"" . $level['abbr'] . "\"></td>";
725  $html .= "<td align=right>".$level['reqrp']."</td>";
726  $html .= "<td align=right>".$level['reqkp']."</td></tr>";
727}
728$html .= "</table><br>";
729// SAVE thingy
730$html .= "<table class=kb-subtable><tr><td width=120></td><td colspan=3 ><input type=submit name=submit value=\"Save\"></td></tr>";
731$html .= "</table>";
732$html .= "</form>";
733
734$page->setContent($html);
735$page->addContext($menubox->generate());
736$page->generate();
737?>
Note: See TracBrowser for help on using the browser.