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'] ?>">
70 <fieldset
class="content">
71 <legend
><label
><input type
="radio" name
="themetype" value
="premade"<?php
72 echo 0 < $user->theme ?
' checked="checked"' : '' ?
>/> Premade Theme
</label
></legend
>
73 <p
><label
>Select theme
: <?php
echo $premade_themes->display() ?
></label
></p
>
74 <p
><label
><input type
="checkbox" name
="importpre"/> Set your custom theme to this
</label
></p
>
76 <fieldset
class="content">
77 <legend
><label
><input type
="radio" name
="themetype" value
="import"/> Import from user
</label
></legend
>
78 <p
><label
>User name
: <?php
echo $user_themes->display() ?
></label
></p
>
80 <fieldset
class="content">
81 <legend
><label
><input type
="radio" name
="themetype" value
="custom"<?php
82 echo 0 == $user->theme ?
' checked="checked"' : '' ?
>/> Custom CSS
</label
></legend
>
83 <textarea rows
="20" cols
="80" name
="user_css" id
="user_css"><?php
echo $css_textbox ?
></textarea
>
86 <button type
="submit" name
="submit" accesskey
="s">Save
Settings (S
)</button
>
88 <h3
>Some useful CSS
:</h3
>
90 <dt
><code
>#userheader</code>, <code>#navbar</code> (<code>h1 + ul</code>, <code>h1 + ul + ul</code>)</dt>
91 <dd
>Navigation menus at top of page
</dd
>
92 <dt
><code
>h1
</code
></dt
>
94 <dt
><code
>#messagelist</code>, <code>#topiclist</code>, <code>#boardlist</code></dt>
95 <dd
>Container block elements
for message
list/topic
list/board
list</dd
>
96 <dt
><code
>.messagelist_default
</code
>, <code
>.topiclist_default
</code
>, [...]</dt
>
97 <dd
>Class name
for whatever layout is in
use on the above
</dd
>
98 <dt
><code
>body
#so2-<var>{pagename}</var></code></dt>
99 <dd
>ID
for the page being
viewed (filename without
.php extension
)</dd
>