5 * @author Anthony Parsons (xmpp:ant@specialops.ath.cx)
6 * @license file://COPYING
11 $page->title
= 'Theme Settings';
13 if ( ! ($user instanceof User_Authenticated
) ) {
14 $page->errorfooter('login');
16 $user->userlinks
['General Settings'] = 'options';
18 $premade_themes = new HTML_Select('premade_theme', 2, $user->theme
);
19 $user_themes = new HTML_Select('user_theme', 2);
21 $premade_themes->db_fill($DB->query('SELECT `themeid`, `theme_name` FROM `themes` ORDER BY `theme_name` ASC', MYSQLI_USE_RESULT
));
22 $user_themes->db_fill($DB->query('SELECT `userid`, `alias` FROM `users` WHERE `theme` = 0 ORDER BY `alias` ASC', MYSQLI_USE_RESULT
));
24 if ( isset($_POST['submit']) ) {
26 switch ( $_POST['themetype'] ) {
28 $premade_themes->check_value($_POST['premade_theme']);
29 $premade_themes->default = intval($_POST['premade_theme']);
31 if ( isset($_POST['importpre']) ) {
32 list($f) = $DB->query('SELECT `css_file` FROM `themes`
33 WHERE `themeid` = '.intval($_POST['premade_theme']))->fetch_row();
34 file_put_contents('css/u'.$user->userid
.'.css', file_get_contents('css/'.$f.'.css'));
37 $user->theme
= intval($_POST['premade_theme']);
42 $user_themes->check_value($_POST['user_theme']);
43 file_put_contents('css/u'.$user->userid
.'.css', file_get_contents('css/u'.intval($_POST['user_theme']).'.css'));
49 file_put_contents('css/u'.$user->userid
.'.css', str_replace("\r\n", "\n", $_POST['user_css']));
53 echo '<p class="notice">Settings have been saved.</p>';
54 } catch ( Exception
$e ) {
56 echo '<p class="error">',$e->getMessage(),'</p>';
62 if ( file_exists('css/u'.$user->userid
.'.css') ) {
63 $css_textbox = htmlspecialchars(file_get_contents('css/u'.$user->userid
.'.css'));
69 <form id
="theme" method
="post" action
="<?php echo $_SERVER['PHP_SELF'] ?>">
71 <fieldset
class="content">
72 <legend
><label
><input type
="radio" name
="themetype" value
="premade"<?php
73 echo 0 < $user->theme ?
' checked="checked"' : '' ?
>/> Premade Theme
</label
></legend
>
74 <p
><label
>Select theme
: <?php
echo $premade_themes->display() ?
></label
></p
>
75 <p
><label
><input type
="checkbox" name
="importpre"/> Set your custom theme to this
</label
></p
>
78 <fieldset
class="content">
79 <legend
><label
><input type
="radio" name
="themetype" value
="import"/> Import from user
</label
></legend
>
80 <p
><label
>User name
: <?php
echo $user_themes->display() ?
></label
></p
>
83 <fieldset
class="content">
84 <legend
><label
><input type
="radio" name
="themetype" value
="custom"<?php
85 echo 0 == $user->theme ?
' checked="checked"' : '' ?
>/> Custom CSS
</label
></legend
>
86 <textarea rows
="20" cols
="80" name
="user_css" id
="user_css"><?php
echo $css_textbox ?
></textarea
>
89 <button type
="submit" name
="submit" accesskey
="s">Save
Settings (S
)</button
>
92 <h3
>CSS classes
&
; IDs
:</h3
>
94 <dt
><code
>h1
</code
></dt
>
96 <dt
><code
>body
#so2-index</code>, [...]</dt>
97 <dd
><code
><
;body
>
;</code
> tag
for index
.php
</dd
>
99 <code
>#userheader</code>,
100 <code
>#navbar</code></dt>
101 <dd
>Generic navigation
list, user navigation
, page navigation
</dd
>
102 <dt
><code
>#messagelist</code>,
103 <code
>#topiclist</code>,
104 <code
>#boardlist</code></dt>
105 <dd
>Message
list/topic
list/board
list</dd
>
106 <dt
><code
>.Messagelist_Default
</code
>,
107 <code
>.Topiclist_Default
</code
>,
108 <code
>.Boardlist_Default
</code
>,
110 <dd
>Layout
-specific classes
for messagelist
/topiclist
/boardlist
</dd
>
111 <dt
><code
>.error
</code
>,
112 <code
>.notice
</code
>,
113 <code
>.info
</code
></dt
>
114 <dd
>Errors
, important messages
and informational messages
</dd
>
115 <dt
><code
>.c0
</code
>,
116 <code
>.c1
</code
></dt
>
117 <dd
>Alternating rows in tables
</dd
>
118 <dt
><code
>.message
</code
>, <code
>.thread
</code
></dt
>
119 <dd
>Messages in messagelist
, threads (threaded view only
)</dd
>