Location: PHPKode > projects > XennoBB > xennobb/admin/notes.php
<?php
/*

  Copyright (C) 2005-2011 UserDot
  Visit XennoBB at www.userdot.net/projects/xennobb
  Originally based on PunBB www.punbb.org

  XennoBB is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  XennoBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  MA 02110-1301 USA

 */
define('IN_FORUM_ADMIN', 1);
require dirname(__FILE__) . '/../include/init.php';
if ($forum_user['g_id'] > USER_MOD)
    BB_Functions::Message($lang['No permission'], true, 1);
$page = isset($_GET['Page']) ? BB_Input::Htmlspecialchars($_GET['Page']) : null;
$page_title = BB_Input::Htmlspecialchars($lang['Admin'] . $lang['Notes']);
$submenu = array($lang['Admin_note'] => 'notes.php?Page=Admin', $lang['Todo_note'] => 'notes.php?Page=ToDo');
require FORUM_ROOT . 'admin/header.php';
if (isset($_POST['new_note']))
{
    if ($_POST['new_note'])
        $_POST['new_note'] .= "\n" . '---- ' . $forum_user['username'] . ' on ' . date('l dS \of F Y h:i:s A' . '----');
    $cms_settings->Set_Namespace('xennobb');
    $res = true;
    $res &= $cms_settings->Save('bb_notes', $_POST['new_note']);
    if ($res)
        BB_Admin_Functions::Log_Action('Change XennoBB configuration', 2);
    $cms_settings->Set_Namespace('');
    BB_Functions::Redirect('notes.php?Page=Admin', $lang['help_notes_note_saved']);
}
if (isset($_POST['new_note_todo']))
{
    if ($_POST['new_note_todo'])
        $_POST['new_note_todo'] .= "\n" . '---- ' . $forum_user['username'] . ' on ' . date('l dS \of F Y h:i:s A' . '----');
    $cms_settings->Set_Namespace('xennobb');
    $res = true;
    $res &= $cms_settings->Save('bb_notes_todo', $_POST['new_note_todo']);
    if ($res)
        BB_Admin_Functions::Log_Action('Change XennoBB configuration', 2);
    $cms_settings->Set_Namespace('');
    BB_Functions::Redirect('notes.php?Page=ToDo', $lang['help_notes_todo_saved']);
}
if ($page == 'Admin')
{
    echo BB_Template::Generate_Menu($submenu);
    ?>
    <div class="blockform">
        <div class="inbox">
            <p>
            <form id="notes" name="notes" method="post" action="notes.php">
                <textarea name="new_note" class="note" cols="80" rows="20"><?php echo bb_notes ?></textarea><br /><br />
                <input type="submit" class="b1" value="<?php echo $lang['SaveNote'] ?>" />&nbsp;
                <input type="button" onclick="document.forms['notes'].elements[0].value =''; return false" class="b1" value="<?php echo $lang['ClearNote'] ?>" /><br />
            </form>
            </p>
        </div>
    </div>
    <?php
}
else if ($page == 'ToDo')
{
    echo BB_Template::Generate_Menu($submenu);
    if ($forum_user['g_id'] == USER_ADMIN)
    {
        ?>
        <div class="blockform">
            <div class="inbox">
                <p>
                <form id="todo_notes" method="post" action="notes.php">
                    <textarea name="new_note_todo" class="note" cols="80" rows="20"><?php echo bb_notes_todo ?></textarea><br /><br />
                    <input type="submit" class="b1" value="<?php echo $lang['SaveTodo'] ?>" />&nbsp;
                    <input type="button" onclick="document.forms['todo_notes'].elements[0].value =''; return false" class="b1" value="<?php echo $lang['ClearTodo'] ?>"><br />
                </form>
                </p>
            </div>
        </div>
        <?php
    }
}
else
    BB_Functions::Message($lang['Bad request']);
require FORUM_ROOT . 'admin/footer.php';
?>
Return current item: XennoBB