============================================================================================================================
Name: Theme Preview

Version: 4.0

Author: GuldantheWarlock (GuldantheWarlock@xmbgarage.com)

Based on: Theme Preview by FunForum.

Description:
This modification will give your members the option to 'preview' Themes and set them as theirs within a second.
After you upload some screenshots the themes will be displayed in their own table using the colors of that theme.
This modification will also display the number of users using a particular theme.

Supported Version: XMB 1.9.5 SP1

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

Author Notes:
Please backup your files before installing this modification.
Neither XMBGarage nor the author can be held responsible if your board stops functioning properly due to you installing this modification.
============================================================================================================================
=======
Step 1:
=======
====================================
Go To Administration Panel --> Insert Raw SQL
====================================
===================================
Paste The Following Code and Submit Changes:
===================================

ALTER TABLE $table_settings ADD themepreviewstatus VARCHAR(3) NOT NULL default 'on';
ALTER TABLE $table_settings ADD themepreviewext SET('jpg','gif','png','bmp') NOT NULL default 'jpg';
ALTER TABLE $table_settings ADD themepreviewguests VARCHAR(3) NOT NULL default 'on';
ALTER TABLE $table_settings ADD themespp INT(3) NOT NULL default '10';

============================================================================================================================
=======
Step 2:
=======
=======================
Edit File: lang/English.lang.php
=======================
========================
Add To End Of File Above  ?>
========================

// Theme Preview Advanced Mod Begin
$lang['themepreview1'] = 'Theme Preview';
$lang['themepreview2'] = 'Theme IDs';
$lang['themepreview3'] = 'Theme Preview Extention:';
$lang['themepreview4'] = 'Guests view Theme Preview:';
$lang['themepreview5'] = 'You must be logged in to preview themes';
$lang['themepreview6'] = 'Set this as my theme';
$lang['themepreview7'] = 'Viewing Themes';
$lang['themepreview8'] = 'Default Theme:';
$lang['themepreview9'] = 'This page shows the proper names for your thumbnail images:';
$lang['themepreview10'] = 'Theme Name';
$lang['themepreview11'] = 'Theme ID';
$lang['themepreview12'] = 'Image URL';
$lang['themepreview13'] = '$lang["themepreview14"] = "This theme is in use by $tusersnum users.";';
$lang['themepreview15'] = 'Theme Preview Status:';
$lang['themepreview16'] = 'Themes Displayed Per Page:';
// Theme Preview Advanced Mod End

============================================================================================================================
=======
Step 3:
=======
==============
Edit File: cp.php
==============
==========
Find Code:
==========

        $resetSigOn = $resetSigOff = '';
        if ($SETTINGS['resetsigs'] == 'on') {
            $resetSigOn = $selHTML;
        } else {
            $resetSigOff = $selHTML;
        }
        
===============
Add Code Below:
===============

        // Theme Preview Advanced Mod Begin
        $tpextjpg = $tpextgif = $tpextpng = $tpextbmp = false;
        switch($SETTINGS['themepreviewext']) {
            case 'jpg':
                $tpextjpg = true;
                break;
            
            case 'gif':
                $tpextgif = true;
                break;
            
            case 'png':
                $tpextpng = true;
                break;
            
            case 'bmp':
                $tpextbmp = true;
                break;
        }
        
        $tpstatuson = $tpstatusoff = '';
        switch ($SETTINGS['themepreviewstatus']) {
             case 'on':
                 $tpstatuson = $selHTML;
                 break;
             default:
                 $tpstatusoff = $selHTML;
                 break;
        }
    
        $tpguestson = $tpguestsoff = '';
        switch ($SETTINGS['themepreviewguests']) {
             case 'on':
                $tpguestson = $selHTML;
                break;
            default:
                $tpguestsoff = $selHTML;
                break;
        }
        // Theme Preview Advanced Mod End

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

        printsetting1($lang['reportpoststatus'], 'reportpostnew', $reportposton, $reportpostoff);
        
===============
Add Code Below:
===============

        // Theme Preview Advanced Mod Begin
        printsetting1($lang['themepreview15'], 'tpstatusnew', $tpstatuson, $tpstatusoff);
        printsetting1($lang['themepreview4'], 'tpguestsnew', $tpguestson, $tpguestsoff);
        printsetting3($lang['themepreview3'], 'tpextnew', array('JPG', 'GIF', 'PNG', 'BMP'), array('jpg', 'gif', 'png', 'bmp'), array($tpextjpg, $tpextgif, $tpextpng, $tpextbmp), false);
        printsetting2($lang['themepreview16'], 'themesppnew', $SETTINGS['themespp'], 4);
        // Theme Preview Advanced Mod End

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

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

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

        // Theme Preview Mod Begin
        $tpstatusnew = ($tpstatusnew == 'on') ? 'on' : 'off';
        // Theme Preview Mod End

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

        $db->query("UPDATE $table_settings SET
        
==========================
Add To End Of Line BEFORE  ");
==========================

, themepreviewstatus='$tpstatusnew', themepreviewguests='$tpguestsnew', themepreviewext='$tpextnew', themespp='$themesppnew'

============================================================================================================================
=======
Step 4:
=======
================
Edit File: header.php
================
==========
Find Code:
==========

$links = implode(' &nbsp; ', $links);
    
===============
Add Code Above:
===============

// Theme Preview-link
if ($SETTINGS['themepreviewstatus'] == 'on') {
    $links[] = "<img src=\"./themes/themes.gif\" alt=\"$lang[themepreview1]\" / border=\"0\" /> <a href=\"./themes.php\"><font class=\"navtd\">$lang[themepreview1]</font></a>";
}
    
============================================================================================================================
=======
Step 5:
=======
===============
Edit File:  misc.php
===============
==========
Find Code:
==========

    } elseif (false !== strpos($url, "/index.php")) {
        $location = $lang['onlineindex'];
        
===============
Add Code Below:
===============

    // Theme Preview Advanced Mod Begin
    } elseif (false !== strpos($url, "/themes.php")) {
        $location = $lang['themepreview7'];
    // Theme Preview Advanced Mod End

============================================================================================================================
=======
Step 6:
=======
===============================
Go To Administration Panel --> Templates
===============================
=============================
Create New Template: theme_preview
=============================
=============================
Add Code Below and Submit Changes:
=============================

<table cellspacing="0" cellpadding="0" border="0" width="$tablewidth" align="center" bgcolor="$bordercolor">
<tr>
<td>
<table border="0" cellspacing="$borderwidth" cellpadding="$tablespace" width="100%">
<tr>
<td class="category" colspan="2"><font color="$cattext"><strong>$lang[themepreview1]</strong></font></td>
</tr>
<tr class="tablerow">
<td colspan="2" bgcolor="$altbg2">$themes</td>
</tr>
$multi
</table></td>
</tr>
</table>

============================================================================================================================
=======
Step 7:
=======
===============================
Go To Administration Panel --> Templates
===============================
================================
Create New Template: theme_preview_row
================================
=============================
Add Code Below and Submit Changes:
=============================

<table cellspacing="0" cellpadding="0" border="0" width="$theme[tablewidth]" align="center" bgcolor="$theme[bordercolor]">
<tr>
<td>
<table border="0" cellspacing="$theme[borderwidth]" cellpadding="$theme[tablespace]" width="100%">
<tr>
<td $tcatcode><font color="$theme[cattext]"><strong>$themename</strong></font></td>
</tr>
<tr class="tablerow">
<td bgcolor="$theme[altbg2]" align="center">$themeimg</td>
</tr>
<tr class="tablerow">
<td bgcolor="$theme[altbg1]" align="center">$lang[themepreview14]<br />$themelink</td>
</tr>
</table></td>
</tr>
</table>
<br />

============================================================================================================================
=======
Step 8:
=======
===============================
Go To Administration Panel --> Templates
===============================
===============================
Create New Template: theme_preview_ids
===============================
=============================
Add Code Below and Submit Changes:
=============================

<table cellspacing="0" cellpadding="0" border="0" width="$tablewidth" align="center" bgcolor="$bordercolor">
<tr>
<td>
<table border="0" cellspacing="$borderwidth" cellpadding="$tablespace" width="100%">
<tr>
<td class="category"><font color="$cattext"><strong>$lang[themepreview2]</strong></font></td>
</tr>
<tr class="tablerow">
<td bgcolor="$altbg2">$lang[themepreview9]<br />
<table border="1">
<tr>
<th>$lang[themepreview10]</th>
<th>$lang[themepreview11]</th>
<th>$lang[themepreview12]</th>
</tr>
$themes
</table></td>
</tr>
</table></td>
</tr>
</table>

============================================================================================================================
=======
Step 9:
=======
===============================
Go To Administration Panel --> Templates
===============================
===================================
Create New Template: theme_preview_ids_row
===================================
=============================
Add Code Below and Submit Changes:
=============================

<tr>
<td>$theme[name]</td>
<td>$theme[themeid]</td>
<td>$filename</td>
</tr>

============================================================================================================================
========
Step 10:
========
===============================
Go To Administration Panel --> Templates
===============================
====================================
Create New Template: theme_preview_multipage
====================================
=============================
Add Code Below and Submit Changes:
=============================

<tr bgcolor="$altbg2">
<td class="smalltxt" align="left" width="50%">$multipage</td>
<td class="smalltxt" align="right" width="50%">$adminlink</td>
</tr>

============================================================================================================================
========
Step 11:
========

Upload provided themes.php from the 'Contents' folder to your forum directory.

Upload provided folder called 'themes' to your 'images' directory.

Upload provided image called 'nothemeimg.png' to your images root directory.

For instructions on the proper names for your theme screenshots, point your browser to themes.php?action=themeids

============================================================================================================================
Enjoy!