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 if ( 0 >= $user->points
) {
17 $page->errorfooter('points');
19 $user->userlinks
['General Settings'] = 'options';
21 $premade_themes = new HTML_Select('premade_theme', 2, $user->theme
);
22 $user_themes = new HTML_Select('user_theme', 2);
24 $premade_themes->db_fill($DB->query('SELECT `themeid`, `theme_name` FROM `themes` ORDER BY `theme_name` ASC', MYSQLI_USE_RESULT
));
25 $user_themes->db_fill($DB->query('SELECT `userid`, `alias` FROM `users` WHERE `theme` = 0 ORDER BY `alias` ASC', MYSQLI_USE_RESULT
));
27 if ( isset($_POST['save']) ) {
29 switch ( $_POST['themetype'] ) {
31 $premade_themes->check_value($_POST['premade_theme']);
32 $premade_themes->default = intval($_POST['premade_theme']);
34 if ( isset($_POST['importpre']) ) {
35 list($f) = $DB->query('SELECT `css_file` FROM `themes`
36 WHERE `themeid` = '.intval($_POST['premade_theme']))->fetch_row();
37 file_put_contents('css/u'.$user->userid
.'.css', file_get_contents('css/'.$f.'.css'));
40 $user->theme
= intval($_POST['premade_theme']);
45 $user_themes->check_value($_POST['user_theme']);
46 file_put_contents('css/u'.$user->userid
.'.css', file_get_contents('css/u'.intval($_POST['user_theme']).'.css'));
52 file_put_contents('css/u'.$user->userid
.'.css', str_replace("\r\n", "\n", $_POST['user_css']));
56 echo '<p class="notice">Settings have been saved.</p>';
57 } catch ( Exception
$e ) {
59 echo '<p class="error">',$e->getMessage(),'</p>';
61 } elseif ( isset($_POST['preview']) ) {
63 echo '<p class="notice">This is a preview of your custom theme. Changes have not been saved.</p>';
68 $css_textbox = htmlspecialchars(
69 empty($_POST['user_css'])
71 file_exists('css/u'.$user->userid
.'.css')
72 ?
file_get_contents('css/u'.$user->userid
.'.css')
77 $themetype = isset($_POST['preview']) ?
0 : $user->theme
;
80 <form id
="theme" method
="post" action
="<?php echo $_SERVER['PHP_SELF'] ?>">
81 <button type
="submit" name
="save" accesskey
="s">Save
Settings (S
)</button
>
82 <fieldset
class="content">
83 <legend
><label
><input type
="radio" name
="themetype" value
="premade"<?php
84 echo 0 < $themetype ?
' checked="checked"' : '' ?
>/> Premade Theme
</label
></legend
>
85 <p
><label
>Select theme
: <?php
echo $premade_themes->display() ?
></label
></p
>
86 <p
><label
><input type
="checkbox" name
="importpre"/> Set your custom theme to this
</label
></p
>
89 <fieldset
class="content">
90 <legend
><label
><input type
="radio" name
="themetype" value
="import"/> Import from user
</label
></legend
>
91 <p
><label
>User name
: <?php
echo $user_themes->display() ?
></label
></p
>
94 <fieldset
class="content">
95 <legend
><label
><input type
="radio" name
="themetype" value
="custom"<?php
96 echo 0 == $themetype ?
' checked="checked"' : '' ?
>/> Custom CSS
</label
></legend
>
97 <textarea rows
="20" cols
="80" name
="user_css" id
="user_css"><?php
echo $css_textbox ?
></textarea
>
98 <p
><a href
="css/">CSS Directory
</a
> <button type
="submit" name
="preview" accesskey
="p">Preview (P
)</button
></p
>
102 <div id
="theme-help">
103 <h3
>CSS classes
&
; IDs
:</h3
>
105 <dt
><code
>h1
</code
></dt
>
107 <dt
><code
>body
#so2-index</code>, [...]</dt>
108 <dd
><code
><
;body
>
;</code
> tag
for index
.php
</dd
>
109 <dt
><code
>.nl
</code
>,
110 <code
>#userheader</code>,
111 <code
>#navbar</code></dt>
112 <dd
>Generic navigation
list, user navigation
, page navigation
</dd
>
113 <dt
><code
>#messagelist</code>,
114 <code
>#topiclist</code>,
115 <code
>#boardlist</code></dt>
116 <dd
>Message
list/topic
list/board
list</dd
>
117 <dt
><code
>.Messagelist_Default
</code
>,
118 <code
>.Topiclist_Default
</code
>,
119 <code
>.Boardlist_Default
</code
>,
121 <dd
>Layout
-specific classes
for messagelist
/topiclist
/boardlist
</dd
>
122 <dt
><code
>.error
</code
>,
123 <code
>.notice
</code
>,
124 <code
>.info
</code
></dt
>
125 <dd
>Errors
, important messages
and informational messages
</dd
>
126 <dt
><code
>.c0
</code
>,
127 <code
>.c1
</code
></dt
>
128 <dd
>Alternating rows in tables
</dd
>
129 <dt
><code
>.message
</code
>, <code
>.thread
</code
></dt
>
130 <dd
>Messages in messagelist
, threads (threaded view only
)</dd
>
131 <dt
><code
>.message
> .info
</code
>, <code
>.message
> .content
</code
></dt
>
132 <dd
>Message header
&
; message body
</dd
>
133 <dt
><code
>.message
.u100
</code
></dt
>
134 <dd
>Any messages posted by a user with userid
100</dd
>