=======================================================================================================================================
Modification Title: Notepad

Modification Version: 1.0

Modification Author: John Briggs

Modification Description:
This modification will provide a personal notepad for each member which can be used for storing notes etc..
This modification will provide an on/off control via the admin settings panel.

Modification Copyright: 2004-2009 John Briggs. All rights reserved.

Modification Compatibility: XMB 1.9.11 Final

Modification Install Note: Before adding this modification to your forum you should back up all files related to this modification.

Modification License Note: This modification is released under the GPL v3 License. A copy is provided with this software.

Modification Author Note:
This modification is developed and released for use with XMB 1.9.11 only.

=======================================================================================================================================
=======
Step 1:
=======

============================================
Go to Administration Panel -> Insert Raw SQL
============================================

Drop each line below into the window and press the "submit" button:

ALTER TABLE `$table_members` ADD `notepad` text NOT NULL;
ALTER TABLE `$table_settings` ADD `notepadstatus` set('on','off') NOT NULL default 'on';

=======================================================================================================================================
=======
Step 2:
=======

=================
Edit File: cp.php
=================

==========
Find Code:
==========

        $remoteimageson = $remoteimagesoff = '';
        settingHTML('attach_remote_images', $remoteimageson, $remoteimagesoff);

===============
Add Code Below:
===============

        // Notepad Mod Begin
        $notepadstatuson = $notepadstatusoff = '';
        settingHTML('notepadstatus', $notepadstatuson, $notepadstatusoff);
        // Notepad Mod End

==========
Find Code:
==========

        printsetting1($lang['reportpoststatus'], 'reportpostnew', $reportposton, $reportpostoff);

===============
Add Code Below:
===============

        // Notepad Mod Begin
        printsetting1($lang['notepadstatus'], 'notepadstatusnew', $notepadstatuson, $notepadstatusoff);
        // Notepad Mod End

==========
Find Code:
==========

        $remoteimages = formOnOff('remoteimages');

===============
Add Code Below:
===============

        // Notepad Mod Begin
        $notepadstatusnew = formOnOff('notepadstatusnew');
        // Notepad Mod End

==========
Find Code:
==========

        $sql = "UPDATE ".X_PREFIX."settings SET

================
Replace Code With:
================

        $sql = "UPDATE ".X_PREFIX."settings SET
            notepadstatus='$notepadstatusnew',

=======================================================================================================================================
========
Step: 3:
========

====================
Edit File: memcp.php
====================

==========
Find Code:
==========

loadtemplates(

===============
Add Code Below:
===============

'memcp_notepad',

==========
Find Code:
==========

    global $THEME, $bordercolor, $tablewidth, $altbg1, $altbg2, $lang;

===============
Add Code Below:
===============

    // Notepad Mod Begin
    global $SETTINGS;
    // Notepad Mod End

==========
Find Code:
==========

    $output .= "<td bgcolor=\"$altbg2\" width=\"20%\" class=\"ctrtablerow\"><a href=\"u2u.php\" onclick=\"Popup(this.href, 'Window', 700, 450); return false;\">" .$lang['textu2umessenger']. "</a></td>";

===============
Add Code Below:
===============

    // Notepad Mod Begin
    if ($SETTINGS['notepadstatus'] == 'on') {
        $output .= "<td bgcolor=\"$altbg2\" width=\"20%\" class=\"ctrtablerow\"><a href=\"memcp.php?action=notepad\" onclick=\"Popup(this.href, 'Window', 350, 250); return false;\">".$lang['notepad']."</a></td>";
    }
    // Notepad Mod End

==========
Find Code:
==========

if (X_GUEST) {
    redirect($full_url.'misc.php?action=login', 0);
    exit();
}

===============
Add Code Below:
===============

// Notepad Mod Begin
$note_pad = '';
if ($SETTINGS['notepadstatus'] == 'on' && $action == 'notepad') {
    if (noSubmit('savesubmit') && (noSubmit('clearsubmit'))) {
        $notes = $self['notepad'];
        eval('$note_pad = "'.template('memcp_notepad').'";');
        echo $note_pad;
    }

    if (onSubmit('savesubmit')) {
        $notes = postedVar('notes', 'javascript', TRUE, TRUE, TRUE);
        $db->query("UPDATE ".X_PREFIX."members SET notepad='$notes' WHERE username='$xmbuser'");
        redirect($full_url.'memcp.php?action=notepad', 0);
    }

    if (onSubmit('clearsubmit')) {
        $db->query("UPDATE ".X_PREFIX."members SET notepad='' WHERE username='$xmbuser'");
        redirect($full_url'memcp.php?action=notepad', 0);
    }
    exit();
}
// Notepad Mod End

=======================================================================================================================================
=======
Step 4:
=======

=================
Edit File: member.php
=================

==================
Find Code 2 Times:
==================

) VALUES ('$username',

======================
Replace Code With 2 Times:
======================

, notepad) VALUES ('$username',

===================================
Find Code At End Of Above Query Statements:
===================================

)");

==================
Replace Code With:
==================

, '')");

=======================================================================================================================================
=======
Step 5:
=======

=====================
Edit File: header.php
=====================

==========
Find Code:
==========

/* Set Up HTML Templates and Themes */

===============
Add Code Below:
===============

// Notepad Mod Begin
// Assert Notepad Hack Translation
if (!isset($lang['notepadstatus'])) {
    require_once(ROOT.'include/translation.inc.php');
    $phrases = array();
    $phrases['notepadstatus'] = "Notepad Status:";
    $phrases['notepad'] = "Notepad";
    $phrases['notepadsave'] = "Save";
    $phrases['notepadclear'] = "Clear";
    setManyLangValues($phrases, $langfile);
    loadLang($langfile);
}
// Notepad Mod End

==========
Find Code:
==========

    $u2ulink = "<a href=\"u2u.php\" onclick=\"Popup(this.href, 'Window', 700, 450); return false;\">{$lang['banu2u']}</a> - ";
    $notify = $lang['loggedin'].' <a href="member.php?action=viewpro&amp;member='.recodeOut($xmbuser).'">'.$xmbuser.'</a><br />['.$loginout.' - '.$u2ulink.''.$memcp.''.$cplink.']';

==================
Replace Code With:
==================

    $u2ulink = "<a href=\"u2u.php\" onclick=\"Popup(this.href, 'Window', 700, 450); return false;\">{$lang['banu2u']}</a> - ";
    // Notepad Mod Begin
    $notelink = '';
    if ($SETTINGS['notepadstatus'] == 'on') {
        $notelink = "<a href=\"memcp.php?action=notepad\" onclick=\"Popup(this.href, 'Window', 350, 250); return false;\">{$lang['notepad']}</a> - ";
    }
    // Notepad Mod End
     $notify = $lang['loggedin'].' <a href="member.php?action=viewpro&amp;member='.recodeOut($onlineuser).'">'.$xmbuser.'</a><br />['.$loginout.' - '.$u2ulink.''.$notelink.''.$memcp.''.$cplink.']';

=======================================================================================================================================
=======
Step 6:
=======

====================
Edit File: index.php
====================

==========
Find Code:
==========

'index_welcome_member',

===============
Add Code Below:
===============

'index_welcome_member_notepad',

==========
Find Code:
==========

    if (X_MEMBER) {
        eval('$welcome = "'.template('index_welcome_member').'";');
    } else {
        eval('$welcome = "'.template('index_welcome_guest').'";');
    }

==================
Replace Code With:
==================

    if (X_MEMBER) {
        // Notepad Mod Begin
        $notepadlink = '';
        if ($SETTINGS['notepadstatus'] == 'on') {
            eval('$notepadlink = "'.template('index_welcome_member_notepad').'";');
        }
        // Notepad Mod End
        eval('$welcome = "'.template('index_welcome_member').'";');
    } else {
        eval('$welcome = "'.template('index_welcome_guest').'";');
    }

==========
Find Code:
==========

    $ticker = $welcome = $whosonline = $statsbar = $whosonlinetoday = '';

==================
Replace Code With:
==================

    $ticker = $welcome = $whosonline = $statsbar = $whosonlinetoday = $notepadlink = '';

=======================================================================================================================================
=======
Step 7:
=======

===============================================================
Go to Administration Panel -> Templates -> index_welcome_member
===============================================================

==========
Find Code:
==========

<td width="33%"><a href="memcp.php"><strong>$lang[textusercp]</strong></a></td>

===============
Add Code Below:
===============

$notepadlink

====================
Find All Occassions:
====================

33%

============================
Replace All Occassions With:
============================

25%

==========
Find Code:
==========

<td colspan="3">

==================
Replace Code With:
==================

<td colspan="4">

=======================================================================================================================================
=======
Step 8:
=======

===============================================================================================
Go to Administration Panel -> Templates -> Create Template Name -> index_welcome_member_notepad
===============================================================================================

=========
Add Code:
=========

<td width="25%"><a href="memcp.php?action=notepad" onclick="Popup(this.href, 'Window', 350, 250); return false;"><strong>$lang[notepad]</strong></a></td>

=======================================================================================================================================
=======
Step 9:
=======

================================================================================
Go to Administration Panel -> Templates -> Create Template Name -> memcp_notepad
================================================================================

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=$charset" />
<title>$lang[notepad]</title>
$css
</head>
<body $THEME[bgcode] text="$text">
<form method="post" action="memcp.php?action=notepad">
<table cellspacing="0" cellpadding="0" border="0" width="100%" align="center">
<tr>
<td bgcolor="$THEME[bordercolor]">
<table border="0" cellspacing="$THEME[borderwidth]" cellpadding="$THEME[tablespace]" width="100%" align="center">
<tr class="category">
<td align="center"><font color="$THEME[cattext]"><strong>$lang[notepad]</strong></font></td>
</tr>
<tr class="ctrtablerow">
<td bgcolor="$THEME[altbg2]"><textarea name="notes" style="width: 100%" rows="10">$notes</textarea></td>
</tr>
<tr class="ctrtablerow">
<td bgcolor="$THEME[altbg2]"><input class="submit" type="submit" name="savesubmit" value="$lang[notepadsave]" />&nbsp;<input class="submit" type="submit" name="clearsubmit" value="$lang[notepadclear]" /></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>

=======================================================================================================================================