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']);
33 $t = intval($_POST['premade_theme']);
34 $premade_themes->default = $t;
36 if ( isset($_POST['importpre']) ) {
37 list($f) = $DB->query('SELECT `css_file` FROM `themes` WHERE `themeid` = '.$t)->fetch_row();
38 file_put_contents('css/u'.$user->userid
.'.css', file_get_contents('css/'.$f.'.css'));
46 $user_themes->check_value($_POST['user_theme']);
47 file_put_contents('css/u'.$user->userid
.'.css', file_get_contents('css/u'.intval($_POST['user_theme']).'.css'));
53 file_put_contents('css/u'.$user->userid
.'.css', str_replace("\r\n", "\n", $_POST['user_css']));
57 echo '<p class="notice">Settings have been saved.</p>';
58 } catch ( Exception
$e ) {
60 echo '<p class="error">',$e->getMessage(),'</p>';
62 } elseif ( isset($_POST['preview']) ) {
64 echo '<p class="notice">This is a preview of your custom theme. Changes have not been saved.</p>';
69 $css_textbox = htmlspecialchars(
70 isset($_POST['themetype'], $_POST['user_css']) && 'custom' == $_POST['themetype']
73 file_exists('css/u'.$user->userid
.'.css')
74 ?
file_get_contents('css/u'.$user->userid
.'.css')
76 ) // weirdest ternary I've ever wrote.
78 $themetype = isset($_POST['preview']) ?
0 : $user->theme
;
81 <form id
="theme" method
="post" action
="<?php echo $_SERVER['PHP_SELF'] ?>">
82 <button type
="submit" name
="save" accesskey
="s">Save
Settings (S
)</button
>
83 <fieldset
class="content">
85 <input type
="radio" name
="themetype" value
="premade"<?php
if ( $themetype > 0 ) echo ' checked="checked"' ?
>/> Premade Theme
87 <p
><label
>Select theme
: <?php
echo $premade_themes->display() ?
></label
></p
>
88 <p
><label
><input type
="checkbox" name
="importpre"/> Set your custom theme to this
</label
></p
>
91 <fieldset
class="content">
93 <input type
="radio" name
="themetype" value
="import"/> Import from user
95 <p
><label
>User name
: <?php
echo $user_themes->display() ?
></label
></p
>
98 <fieldset
class="content">
100 <input type
="radio" name
="themetype" value
="custom"<?php
if ( 0 == $themetype ) echo ' checked="checked"' ?
>/> Custom CSS
102 <textarea rows
="20" cols
="80" name
="user_css" id
="user_css"><?php
echo $css_textbox ?
></textarea
>
104 <a href
="css/">CSS Directory
</a
> |
<button type
="submit" name
="preview" accesskey
="p">Preview Custom
CSS (P
)</button
>
109 <div id
="theme-help">
110 <h3
>CSS classes
&
; IDs
:</h3
>
112 <dt
><code
>h1
</code
></dt
>
114 <dt
><code
>body
#so2-index</code>, [...]</dt>
115 <dd
><code
><
;body
>
;</code
> tag
for index
.php
</dd
>
116 <dt
><code
>.nl
</code
>,
117 <code
>#userheader</code>,
118 <code
>#navbar</code></dt>
119 <dd
>Generic navigation
list, user navigation
, page navigation
</dd
>
120 <dt
><code
>#messagelist</code>,
121 <code
>#topiclist</code>,
122 <code
>#boardlist</code></dt>
123 <dd
>Message
list/topic
list/board
list</dd
>
124 <dt
><code
>.Messagelist_Default
</code
>,
125 <code
>.Topiclist_Default
</code
>,
126 <code
>.Boardlist_Default
</code
>,
128 <dd
>Layout
-specific classes
for messagelist
/topiclist
/boardlist
</dd
>
129 <dt
><code
>.error
</code
>,
130 <code
>.notice
</code
>,
131 <code
>.info
</code
></dt
>
132 <dd
>Errors
, important messages
and informational messages
</dd
>
133 <dt
><code
>.c0
</code
>,
134 <code
>.c1
</code
></dt
>
135 <dd
>Alternating rows in tables
</dd
>
136 <dt
><code
>.message
</code
>, <code
>.thread
</code
></dt
>
137 <dd
>Messages in messagelist
, threads (threaded view only
)</dd
>
138 <dt
><code
>.message
> .info
</code
>, <code
>.message
> .content
</code
></dt
>
139 <dd
>Message header
&
; message body
</dd
>
140 <dt
><code
>.message
.u100
</code
></dt
>
141 <dd
>Any messages posted by a user with userid
100</dd
>