Title: Notepad v1.0

Author: John Briggs

Mod Description:
This mod will provide a personal notepad for each member which can be used for storing notes, code snippets, etc.
This mod will provide a on or off control via the admin settings panel.

Copyright:  2006 John Briggs. All rights reserved.

Compatability: XMB 1.9.5 Final

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

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

Author Note:
You downloaded this hack from XMBMods.com, the #1 source for XMB related downloads.
Please visit http://www.xmbmods.com/ for support.

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

===================================
Go to admin panel -> Insert Raw SQL
===================================

Upload provided file named "SQL.txt" & click "Submit Changes" button.

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

================================
Edit File: lang/English.lang.php
================================

================================
Add Code At very Bottom of File:
================================

// Notepad Mod Begin
$lang['notepadstatus'] = "Notepad Status:";
$lang['notepad'] = "Notepad";
$lang['notepadsave'] = "Save";
$lang['notepadclear'] = "Clear";
// Notepad Mod End

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

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

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

        $avchecked[0] = $avchecked[1] = $avchecked[2] = false;

        if (!empty($avatarlist)) {
            $avchecked[1] = true;
        } elseif (!empty($avataroff)) {
            $avchecked[2] = true;
        } else {
            $avchecked[0] = true;
        }

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

        $notepadstatus_on = $notepadstatus_off = '';
        switch ($SETTINGS['notepadstatus']) {
            case 'on':
                $notepadstatus_on = $selHTML;
                break;
            default:
                $notepadstatus_off = $selHTML;
                break;
        }

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

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

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

        printsetting1($lang['notepadstatus'], 'notepadstatusnew', $notepadstatus_on, $notepadstatus_off);

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

        $resetSigNew = ($resetSigNew == 'on') ? 'on' : 'off';

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

        $notepadstatusnew = ($notepadstatusnew == 'on') ? 'on' : 'off';

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

$db->query("UPDATE $table_settings SET

========================================================
Find code In-Line at end of above statement at very end:
========================================================

");

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

, notepadstatus='$notepadstatusnew'");

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

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

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

loadtemplates(

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

loadtemplates('memcp_notepad',

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

    global $bordercolor, $tablewidth, $borderwidth, $tablespacing, $altbg1, $altbg2, $lang;

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

    global $SETTINGS;

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

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

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

    if ($SETTINGS['notepadstatus'] == 'on') {
        echo "<td bgcolor=\"$altbg2\" width=\"10%\" class=\"ctrtablerow\"><a href=\"#\" onclick=\"Popup('memcp.php?action=notepad', 'Window', 350, 250);\">" .$lang['notepad']. "</a></td>";
    }

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

// Determine if user is logged in, if not send to login page
if ( X_GUEST ) {
    redirect('misc.php?action=login', 0);
    exit();
}

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

$note_pad = '';
if ($SETTINGS['notepadstatus'] == 'on' && $action == 'notepad') {
    if (!isset($_POST['savesubmit']) && $_POST['savesubmit'] == '' && !isset($_POST['clearsubmit']) && $_POST['clearsubmit'] == '') {
        $notes = stripslashes($self['notepad']);
        eval ('$note_pad = "'.template('memcp_notepad').'";');
        echo $note_pad;
    }

    if (isset($_POST['savesubmit']) && $_POST['savesubmit'] != '') {
        $_POST['notes'] = addslashes(trim($_POST['notes']));
        $db->query("UPDATE $table_members SET notepad='$_POST[notes]' WHERE username='$xmbuser'");
        redirect('memcp.php?action=notepad', 0);
    }

    if (isset($_POST['clearsubmit']) && $_POST['clearsubmit'] != '') {
        $db->query("UPDATE $table_members SET notepad='' WHERE username='$xmbuser'");
        redirect('memcp.php?action=notepad', 0);
    }
    exit;
}

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

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

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

        $db->query("INSERT INTO $table_members (uid,

=====================================
Find Code In-Line In Above Statement:
=====================================

) VALUES ('', '$username',

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

, notepad) VALUES ('', '$username',

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

)");

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

, '')");

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

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

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

loadtemplates(

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

loadtemplates('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) {
        $notepadlink = '';
        if ($SETTINGS['notepadstatus'] == 'on') {
            eval('$notepadlink = "'.template('index_welcome_member_notepad').'";');
        }
        eval('$welcome = "'.template('index_welcome_member').'";');
    } else {
        eval('$welcome = "'.template('index_welcome_guest').'";');
    }

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

=====================================================
Go to admin panel -> templates-> index_welcome_member
=====================================================

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

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

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

$notepadlink

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

33%

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

15%

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

<td colspan="3">

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

<td colspan="4">

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

=====================================================================================
Go to admin panel -> templates-> create template name -> index_welcome_member_notepad
=====================================================================================

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

<td class="ctrtablerow" bgcolor="$altbg2" width="15%"><a href="#" onclick="Popup('memcp.php?action=notepad', 'Window', 350, 250)"><strong>$lang[notepad]</strong></a></td>

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

======================================================================
Go to admin 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 $bgcode text="$text">
<form method="post" action="memcp.php?action=notepad">
<table cellspacing="0" cellpadding="0" border="0" width="$tablewidth" align="center">
<tr>
<td bgcolor="$bordercolor">
<table border="0" cellspacing="$borderwidth" cellpadding="$tablespace" width="100%" align="center">
<tr class="category">
<td class="ctrtablerow"><strong><font color="$cattext">$lang[notepad]</font></strong></td>
</tr>
<tr>
<td class="ctrtablerow" bgcolor="$altbg1"><textarea name="notes" style="width: 100%" rows="10">$notes</textarea></td>
</tr>
<tr>
<td class="ctrtablerow" bgcolor="$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>

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