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['save']) ) {
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>';
58 } elseif ( isset($_POST['preview']) ) {
60 echo '<p class="notice">This is a preview of your custom theme. Changes have not been saved.</p>';
65 $css_textbox = htmlspecialchars(
66 empty($_POST['user_css'])
68 file_exists('css/u'.$user->userid
.'.css')
69 ?
file_get_contents('css/u'.$user->userid
.'.css')
74 $themetype = isset($_POST['preview']) ?
0 : $user->theme
;
77 <form id
="theme" method
="post" action
="<?php echo $_SERVER['PHP_SELF'] ?>">
78 <button type
="submit" name
="save" accesskey
="s">Save
Settings (S
)</button
>
79 <fieldset
class="content">
80 <legend
><label
><input type
="radio" name
="themetype" value
="premade"<?php
81 echo 0 < $themetype ?
' checked="checked"' : '' ?
>/> Premade Theme
</label
></legend
>
82 <p
><label
>Select theme
: <?php
echo $premade_themes->display() ?
></label
></p
>
83 <p
><label
><input type
="checkbox" name
="importpre"/> Set your custom theme to this
</label
></p
>
86 <fieldset
class="content">
87 <legend
><label
><input type
="radio" name
="themetype" value
="import"/> Import from user
</label
></legend
>
88 <p
><label
>User name
: <?php
echo $user_themes->display() ?
></label
></p
>
91 <fieldset
class="content">
92 <legend
><label
><input type
="radio" name
="themetype" value
="custom"<?php
93 echo 0 == $themetype ?
' checked="checked"' : '' ?
>/> Custom CSS
</label
></legend
>
94 <textarea rows
="20" cols
="80" name
="user_css" id
="user_css"><?php
echo $css_textbox ?
></textarea
>
95 <p
><a href
="css/">CSS Directory
</a
> <button type
="submit" name
="preview" accesskey
="p">Preview (P
)</button
></p
>
100 <h3
>CSS classes
&
; IDs
:</h3
>
102 <dt
><code
>h1
</code
></dt
>
104 <dt
><code
>body
#so2-index</code>, [...]</dt>
105 <dd
><code
><
;body
>
;</code
> tag
for index
.php
</dd
>
106 <dt
><code
>.nl
</code
>,
107 <code
>#userheader</code>,
108 <code
>#navbar</code></dt>
109 <dd
>Generic navigation
list, user navigation
, page navigation
</dd
>
110 <dt
><code
>#messagelist</code>,
111 <code
>#topiclist</code>,
112 <code
>#boardlist</code></dt>
113 <dd
>Message
list/topic
list/board
list</dd
>
114 <dt
><code
>.Messagelist_Default
</code
>,
115 <code
>.Topiclist_Default
</code
>,
116 <code
>.Boardlist_Default
</code
>,
118 <dd
>Layout
-specific classes
for messagelist
/topiclist
/boardlist
</dd
>
119 <dt
><code
>.error
</code
>,
120 <code
>.notice
</code
>,
121 <code
>.info
</code
></dt
>
122 <dd
>Errors
, important messages
and informational messages
</dd
>
123 <dt
><code
>.c0
</code
>,
124 <code
>.c1
</code
></dt
>
125 <dd
>Alternating rows in tables
</dd
>
126 <dt
><code
>.message
</code
>, <code
>.thread
</code
></dt
>
127 <dd
>Messages in messagelist
, threads (threaded view only
)</dd
>
128 <dt
><code
>.message
> .info
</code
>, <code
>.message
> .content
</code
></dt
>
129 <dd
>Message header
&
; message body
</dd
>
130 <dt
><code
>.message
.u100
</code
></dt
>
131 <dd
>Any messages posted by a user with userid
100</dd
>