root/dev/mods/forum_post/settings.php @ 212

Revision 212, 4.8 KB (checked in by ralle030583, 15 years ago)

- replaced $config->getConfig with config::getconfig so we havent a mix in all files<br>
- added valing='top' to award boxes to make the awards nice in board with not many pilots<br>
- removed not needed includes<br>
- added event 'killmail_delete' which is called before real delete of a killmail<br>
- admin can see classified system in the killmaildetails

Line 
1<?php
2require_once( "common/admin/admin_menu.php" );
3require_once("common/includes/class.ship.php");
4
5$colours =array("red" ,
6"blue" ,
7"pink" ,
8"brown" ,
9"black" ,
10"orange" ,
11"violet" ,
12"yellow" ,
13"green" ,
14"gold" ,
15"white" ,
16"purple" ,
17"limegreen" ,
18"maroon" ,
19"navy" ,
20"teal" ,
21"beige" );
22
23$styles = array("strikethrough"=>"s","underline"=>"u","bold"=>"b","italic"=>"i");
24if(isset($_POST['Reset']))
25{
26config::setConfig('forum_post_colours',"");
27config::setConfig('forum_post_styles',"");
28$confirm = "<strong>Settings Reset</strong><br/>";
29}
30
31
32if(isset($_POST['submit'])) //workings
33{
34        $sql = "select scl_id, scl_class
35                        from kb3_ship_classes
36                   where scl_class not in ( 'Drone', 'Unknown' )
37                  order by scl_class";
38
39        $qry = new DBQuery();
40        $qry->execute($sql) or die($qry->getErrorMsg());
41       
42        $forum_post_colours = array();
43        $forum_post_styles = array();
44        while ($row = $qry->getRow())
45        {
46                $value = str_replace(" ","",$row['scl_class']);
47                //echo $_POST[$value.'_colour']."<br>";
48                if($_POST[$value.'_colour'] != "None")
49                {
50                        $forum_post_colours[$value] = $_POST[$value.'_colour'];
51                }       
52                if($_POST[$value.'_style'] != "None")
53                {
54                        $forum_post_styles[$value] = $_POST[$value.'_style'];
55                }       
56       
57        }
58config::setConfig('forum_post_colours',serialize($forum_post_colours) );
59config::setConfig('forum_post_styles',serialize($forum_post_styles));
60config::setConfig('forum_post_isk',$_POST['isk']);
61config::setConfig('forum_post_order',$_POST['order']);
62
63$confirm = "<strong>Settings Saved</strong><br/>";
64} // end workings
65
66
67$page = new Page( "Settings - Forum Post" );
68$html .= $confirm;
69
70$set_colours = unserialize(config::getConfig('forum_post_colours'));    //load colour settings
71if(!is_array($set_colours)) { $set_colours = array(); }                                 // if the settings have been reset create an empty array so as not to brake the code later on
72$set_styles = unserialize(config::getConfig('forum_post_styles'));              //load style settings
73if(!is_array($set_styles)) { $set_styles = array(); }                                   // if the settings have been reset create an empty array so as not to brake the code later on
74$set_isk = config::getConfig('forum_post_isk',$_POST['isk']);                   // load isk setting
75
76//print_r($set_styles);
77
78        $sql = "select scl_id, scl_class
79                        from kb3_ship_classes
80                   where scl_class not in ( 'Drone', 'Unknown' )
81                  order by scl_class";
82
83        $qry = new DBQuery();
84        $qry->execute($sql) or die($qry->getErrorMsg());
85       
86        $html .='<form action="" method="post"><table name="settings"><tr><td>Ship Class</td><td>Colour</td><td>Style</td></tr>';
87       
88        while ($row = $qry->getRow())
89        {
90        $html .="<tr>";
91        $html .= '<td>'.$row['scl_class'].'</td><td>';
92       
93        $class = str_replace(" ","",$row['scl_class']);
94        $html.='<select name="'.$class.'_colour">';
95       
96        if(array_key_exists($class,$set_colours)) //check to see if it is set.
97        {
98                $html .= '<option value="None">None</option>';
99        }        //colour has been set previously
100        else
101        {
102        $html .= '<option value="None" selected="selected">None</option>';
103        }
104        foreach($colours as $select)
105                {
106                        $html .='<option value="'.$select.'"';
107                                                        if($select == $set_colours[$class]) { $html .= ' selected="selected"'; } //select this option
108
109                        $html .='>'.$select.'</option>';
110                }
111        $html .="</select></td><td>";
112       
113       
114        $html.='<select name="'.str_replace(" ","",$row['scl_class']).'_style">';
115       
116        if(array_key_exists($class,$set_styles)) //check to see if it is set.
117        {
118                $html .= '<option value="None">None</option>';
119        }        //colour has been set previously
120        else
121        {
122        $html .= '<option value="None" selected="selected">None</option>';
123        }
124
125                foreach($styles as $select => $v)
126                {
127                        $html .='<option value="'.$v.'"';
128                                                        if($v == $set_styles[$class]) { $html .= ' selected="selected"'; } //select this option
129
130                        $html .='>'.$select.'</option>';
131                }
132       
133        $html .="</select></td></tr>";
134        }
135       
136        $html .='
137        <tr>
138        <hr/>
139    <td colspan="3"><hr/><input name="isk" type="checkbox" value="yes" ';
140        if($set_isk == "yes") { $html .= "checked"; }
141        $html .='> Include individual Isk Values?<br/><br/>
142       
143        Place ship class at start or end of each line?<br/>';
144        if(config::getConfig('forum_post_order') != "last"){
145       
146        $html .= '<input name="order" type="radio" value="first" checked="checked"/>Start<br/>
147        <input name="order" type="radio" value="last" />End<hr/>';
148        }
149        else
150        {
151        $html .= '<input name="order" type="radio" value="first" />Start<br/>
152        <input name="order" type="radio" value="last" checked="checked" />End<hr/>';
153        }
154        $html .= '</td></tr>';
155       
156        $html .='
157        <tr>
158    <td colspan="3"><input type="submit" value="submit" name="submit"> <input type="submit" value="Reset" name="Reset"></td>
159        </tr>
160  </table></form>';
161                                                     
162$page->setContent( $html );
163$page->addContext( $menubox->generate() );
164$page->generate();
165?>
Note: See TracBrowser for help on using the browser.