root/trunk/redirectors/postinghelp.php

Revision 297, 8.1 kB (checked in by hannes, 3 years ago)

new formatting tags: tables and lists (ticket #118)

Line 
1 <?php
2
3 /**
4  * Package: Spam Board 5
5  * File: redirectors/postinghelp.php
6  * Description: Show the board code and smileys explanations
7  *
8  * Copyright (C) 2007, 2009 Hannes Schueller
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Affero General Public License as
12  * published by the Free Software Foundation, version 3 of the
13  * License.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Affero General Public License for more details.
19  *
20  * You should have received a copy of the GNU Affero General Public License
21  * along with this program (see LICENCE). If not,
22  * see <http://www.gnu.org/licenses/>.
23  **/
24
25 // called independently from index
26 require_once('../includes/config/settings.php');
27
28 // load classes on demand
29 function __autoload($class) {
30     global $SETTINGS;
31     if (is_file($SETTINGS['fspath'] . 'classes/pages/' . $class . '.php')) {
32         require_once($SETTINGS['fspath'] . 'classes/pages/' . $class . '.php');
33     } elseif (is_file($SETTINGS['fspath'] . 'classes/misc/' . $class . '.php')) {
34         require_once($SETTINGS['fspath'] . 'classes/misc/' . $class . '.php');
35     } else { die('Class ' . $class . ' not found.'); }
36 }
37
38 // initialize global warnings array
39 $WARNINGS = Array();
40
41 // import version number
42 require_once($SETTINGS['fspath'] . 'includes/config/version.php');
43 // bots definition
44 require_once($SETTINGS['fspath'] . 'includes/config/bots.php');
45 // formatting object
46 $F = new Format();
47 require($SETTINGS['fspath'] . 'includes/lang/' . $SETTINGS['language'] . '.php');
48 // open database connection
49 $C = new Connection();
50 Member::session();
51 if (isset($_SESSION['lang']) && $_SESSION['lang'] != '') {
52     include($SETTINGS['fspath'] . 'includes/lang/' . $_SESSION['lang'] . '.php');
53 }
54 // translate passed variables to local identifiers
55 require($SETTINGS['fspath'] . 'includes/input.php');
56
57 // page start
58 $_pref = '../';
59 $html = Page::start();
60
61 // check if user has permission; required: read; independent from id
62 if (Member::checkRights('Postinghelp', 'r')) {
63     // permission granted
64     // output
65     $html->body->addChild('h2', $LANG['Help']);
66     $div = $html->body->addChild('div');
67     $div->addAttribute('class', 'message');
68     // board code
69     $_table = new Table('helptable');
70     $_table->addHeaderRow(Array('<th colspan="2">' . $LANG['Formatting_Help'] . '</th>'));
71     $_table->addRow(Array('[b]' . $LANG['Bold'] . '[/b]', '<td><b>' . $LANG['Bold'] . '</b></td>'));
72     $_table->addRow(Array('[i]' . $LANG['Italics'] . '[/i]', '<td><i>' . $LANG['Italics'] . '</i></td>'));
73     $_table->addRow(Array('[u]' . $LANG['Underline'] . '[/u]', '<td><u>' . $LANG['Underline'] . '</u></td>'));
74     $_table->addRow(Array('[s]' . $LANG['Strike'] . '[/s]', '<td><s>' . $LANG['Strike'] . '</s></td>'));
75     $_table->addRow(Array('[color=red]' . $LANG['Colour'] . '[/color]', '<td style="color:red">' . $LANG['Colour'] . '</td>'));
76     $_table->addRow(Array('[size=14]' . $LANG['Size'] . '[/size]', '<td style="font-size:14px">' . $LANG['Size'] . '</td>'));
77     $_table->addRow(Array('[font=serif]' . $LANG['Font'] . '[/font]', '<td style="font-family:serif">' . $LANG['Font'] . '</td>'));
78     $_table->addRow(Array('[align=center]' . $LANG['Alignment'] . '[/align]', '<td align="center">' . $LANG['Alignment'] . '</td>'));
79     $_table->addRow(Array('[quote]' . $LANG['Quote'] . '[/quote]', '<td><div class="quote1">' . $LANG['Quote'] . ':</div><div class="quote">' . $LANG['Quote'] . '</div></td>'));
80     $_table->addRow(Array('<td>[code]<br />function bogo ($i) {<br />&amp;nbsp;&amp;nbsp;$i++;<br />}<br />[/code]</td>', '<td><div class="code1">' . $LANG['Code'] . ':</div><pre class="code">function bogo ($i) {' . "\n  \$i++;\n}" . '</pre></td>'));
81     $_logo = 'http://' . $_SERVER['HTTP_HOST'] . str_replace('/redirectors', '', substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'))) . '/images/' . $SETTINGS['forumlogo'];
82     $_size = getimagesize($SETTINGS['fspath'] . 'images/' . $SETTINGS['forumlogo']);
83     $_table->addRow(Array('<td colspan="2">[img]' . $_logo . '[/img]</td>'));
84     $_table->addRow(Array('<td colspan="2"><img src="' . $_logo . '" width="' . $_size[0] . '" height="' . $_size[1] . '" alt="Image" /></td>'));
85     $_url = 'http://' . $_SERVER['HTTP_HOST'] . str_replace('/redirectors', '', substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')));
86     $_table->addRow(Array('[url]' . $_url . '[/url]', '<td><a target="_blank" href="' . $_url . '">' . $_url . '</a></td>'));
87     $_table->addRow(Array('[url=' . $_url . ']' . $LANG['Link'] . '[/url]', '<td><a target="_blank" href="' . $_url . '">' . $LANG['Link'] . '</a></td>'));
88     $_mail = 'person@example.org';
89     $_table->addRow(Array('[email]' . $_mail . '[/email]', '<td><a href="mailto:' . $_mail . '">' . $_mail . '</a></td>'));
90     $_table->addRow(Array('[email=' . $_mail . ']' . $LANG['E-Mail'] . '[/url]', '<td><a href="mailto:' . $_mail . '">' . $LANG['E-Mail'] . '</a></td>'));
91     $_table->addRow(Array('[table][row][cell]A[/cell][cell]B[/cell][/row][row][cell]C[/cell][cell]D[/cell][/row][/table]', '<td><table class="usertable"><tr><td>A</td><td>B</td></tr><tr><td>C</td><td>D</td></tr></table></td>'));
92     $_table->addRow(Array('[list][item]A[/item][item]B[/item][/list]', '<td><ul class="userlist"><li>A</li><li>B</li></ul></td>'));
93     $div->addElement($_table->get());
94     $div->addChild('br');
95     /* smileys */
96     $_table = new Table('helptable');
97     $_table->addHeaderRow(Array('<th colspan="2">' . $LANG['Smileys'] . '</th>'));
98     $_size = getimagesize($SETTINGS['fspath'] . 'images/smilies/smile.gif');
99     $_table->addRow(Array(':)', '<td><img ' . $_size[3] . ' src="' . $SETTINGS['webpath'] . 'images/smilies/smile.gif" alt=":)" align="middle" /></td>'));
100     $_size = getimagesize($SETTINGS['fspath'] . 'images/smilies/sad.gif');
101     $_table->addRow(Array(':(', '<td><img ' . $_size[3] . ' src="' . $SETTINGS['webpath'] . 'images/smilies/sad.gif" alt=":(" align="middle" /></td>'));
102     $_size = getimagesize($SETTINGS['fspath'] . 'images/smilies/wink.gif');
103     $_table->addRow(Array(';)', '<td><img ' . $_size[3] . ' src="' . $SETTINGS['webpath'] . 'images/smilies/wink.gif" alt=";)" align="middle" /></td>'));
104     $_size = getimagesize($SETTINGS['fspath'] . 'images/smilies/biggrin.gif');
105     $_table->addRow(Array(':D', '<td><img ' . $_size[3] . ' src="' . $SETTINGS['webpath'] . 'images/smilies/biggrin.gif" alt=":D" align="middle" /></td>'));
106     $_size = getimagesize($SETTINGS['fspath'] . 'images/smilies/shocked.gif');
107     $_table->addRow(Array(':o', '<td><img ' . $_size[3] . ' src="' . $SETTINGS['webpath'] . 'images/smilies/shocked.gif" alt=":o" align="middle" /></td>'));
108     $_size = getimagesize($SETTINGS['fspath'] . 'images/smilies/tongue.gif');
109     $_table->addRow(Array(':P', '<td><img ' . $_size[3] . ' src="' . $SETTINGS['webpath'] . 'images/smilies/tongue.gif" alt=":P" align="middle" /></td>'));
110     $_size = getimagesize($SETTINGS['fspath'] . 'images/smilies/angry.gif');
111     $_table->addRow(Array('&gt;:(', '<td><img ' . $_size[3] . ' src="' . $SETTINGS['webpath'] . 'images/smilies/angry.gif" alt="&gt;:(" align="middle" /></td>'));
112     if ($handle = opendir($SETTINGS['fspath'] . 'images/smilies')) {
113         while (FALSE != ($file = readdir($handle))) {
114             if ($file != '.' && $file != '..' && $file != 'smile.gif' && $file != 'tongue.gif' && $file != 'wink.gif' && $file != 'biggrin.gif' && $file != 'shocked.gif' && $file != 'sad.gif' && $file != 'angry.gif' && $file != 'index.htm') {
115                 $smiley = ':' . $file;
116                 $smiley = str_replace('.gif', ':', $smiley);
117                 $_size = getimagesize($SETTINGS['fspath'] . 'images/smilies/' . $file);
118                 $_table->addRow(Array($smiley, '<td><img src="' . $SETTINGS['webpath'] . 'images/smilies/' . $file . '" alt="' . $smiley . '" ' . $_size[3] . ' /></td>'));
119             }
120         }
121         closedir($handle);
122     }
123     $div->addElement($_table->get());
124     $div = $html->body->addChild('div');
125     $div->addAttribute('align', 'center');
126     $a = $div->addChild('a', $LANG['Close_Window']);
127     $a->addAttribute('href', 'javascript:self.close()');
128 } else {
129     $div = $html->body->addChild('div', $LANG['error_permission_denied']);
130     $div->addAttribute('class', 'message');
131 }
132
133 // page output
134 Page::send($html);
135
136 ?>
Note: See TracBrowser for help on using the browser.