Hack Name: Admin Control Panel Redirects v1.0

Description:
This modification will make the admin panel redirect back to the section you are editing.
This modification is based on the earlier version by Jonathon.

Compatibility: XMB 1.9.11

Code Developed By: Adam Clarke

Note: Backup all affected files, templates & database's.

Affected Files: cp.php, cp2.php

Affected Templates: None

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



STEP 1: Edit cp.php

Find Code:
---------------------------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['textsettingsupdate'].'</td></tr>';
---------------------------------------------------------------------------------------------------

Replace With:
--------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['textsettingsupdate'].'</td></tr>';
        redirect($full_url.'cp.php?action=settings', 1.5, X_REDIRECT_JS);
--------------------------------------------------------------------------------


Find Code: (On 2 Occasions)
---------------------------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['textforumupdate'].'</td></tr>';
---------------------------------------------------------------------------------------------------

Replace With:
--------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['textforumupdate'].'</td></tr>';
        redirect($full_url.'cp.php?action=forum', 1.5, X_REDIRECT_JS);
--------------------------------------------------------------------------------


Find Code:
---------------------------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['textmodupdate'].'</td></tr>';
---------------------------------------------------------------------------------------------------

Replace With:
--------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['textmodupdate'].'</td></tr>';
        redirect($full_url.'cp.php?action=mods', 1.5, X_REDIRECT_JS);
--------------------------------------------------------------------------------


Find Code:
---------------------------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'"><td class="ctrtablerow">'.$self['status'].'</td></tr>';
---------------------------------------------------------------------------------------------------

Replace With:
--------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'"><td class="ctrtablerow">'.$self['status'].'</td></tr>';
        redirect($full_url.'cp.php?action=ipban', 1.5, X_REDIRECT_JS);
--------------------------------------------------------------------------------


Find Code:
---------------------------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['textmembersupdate'].'</td></tr>';
---------------------------------------------------------------------------------------------------

Replace With:
--------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['textmembersupdate'].'</td></tr>';
        redirect($full_url.'cp.php?action=members', 1.5, X_REDIRECT_JS);
--------------------------------------------------------------------------------


Find Code:
---------------------------------------------------------------------------------------------------
        eval('echo "'.template('footer').'";');
---------------------------------------------------------------------------------------------------

Replace With:
--------------------------------------------------------------------------------
        eval('echo "'.template('footer').'";');
        redirect($full_url.'cp.php?action=upgrade', 5, X_REDIRECT_JS);
--------------------------------------------------------------------------------




STEP 2: Edit cp2.php

Find Code:
---------------------------------------------------------------------------------------------------
        echo "<tr bgcolor=\"$altbg2\" class=\"tablerow\"><td align=\"center\">$lang[textattachmentsupdate]</td></tr>";
---------------------------------------------------------------------------------------------------

Replace With:
--------------------------------------------------------------------------------
        echo "<tr bgcolor=\"$altbg2\" class=\"tablerow\"><td align=\"center\">$lang[textattachmentsupdate]</td></tr>";
        redirect($full_url.'cp2.php?action=attachments', 1.5, X_REDIRECT_JS);
--------------------------------------------------------------------------------


Find Code:
---------------------------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['censorupdate'].'</td></tr>';
---------------------------------------------------------------------------------------------------

Replace With:
--------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['censorupdate'].'</td></tr>';
        redirect($full_url.'cp2.php?action=censor', 1.5, X_REDIRECT_JS);
--------------------------------------------------------------------------------


Find Code:
---------------------------------------------------------------------------------------------------
        echo "<tr bgcolor=\"$altbg2\" class=\"tablerow\"><td align=\"center\">$lang[forumpruned]</td></tr>";
---------------------------------------------------------------------------------------------------

Replace With:
--------------------------------------------------------------------------------
        echo "<tr bgcolor=\"$altbg2\" class=\"tablerow\"><td align=\"center\">$lang[forumpruned]</td></tr>";
        redirect($full_url.'cp2.php?action=prune', 1.5, X_REDIRECT_JS);
--------------------------------------------------------------------------------


Find Code:
---------------------------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['rankingsupdate'].'</td></tr>';
---------------------------------------------------------------------------------------------------

Replace With:
--------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['rankingsupdate'].'</td></tr>';
        redirect($full_url.'cp2.php?action=ranks', 1.5, X_REDIRECT_JS);
--------------------------------------------------------------------------------


Find Code:
---------------------------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['restrictedupdate'].'</td></tr>';
        redirect($full_url.'cp2.php?action=restrictions', 2);
---------------------------------------------------------------------------------------------------

Replace With:
--------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['restrictedupdate'].'</td></tr>';
        redirect($full_url.'cp2.php?action=restrictions', 1.5, X_REDIRECT_JS);
--------------------------------------------------------------------------------


Find Code:
---------------------------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['smilieupdate'].'</td></tr>';
---------------------------------------------------------------------------------------------------

Replace With:
--------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['smilieupdate'].'</td></tr>';
        redirect($full_url.'cp2.php?action=smilies', 1.5, X_REDIRECT_JS);
--------------------------------------------------------------------------------


Find Code:
---------------------------------------------------------------------------------------------------
        if (!$query) {
            echo $lang['textthemeimportfail'];
        } else {
            echo $lang['textthemeimportsuccess'];
        }
---------------------------------------------------------------------------------------------------

Replace With:
--------------------------------------------------------------------------------
        if (!$query) {
            echo $lang['textthemeimportfail'];
            redirect($full_url.'cp2.php?action=themes', 1.5, X_REDIRECT_JS);
        } else {
            echo $lang['textthemeimportsuccess'];
            redirect($full_url.'cp2.php?action=themes', 1.5, X_REDIRECT_JS);
        }
--------------------------------------------------------------------------------


Find Code: (On 3 Occasions)
---------------------------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['themeupdate'].'</td></tr>';
---------------------------------------------------------------------------------------------------

Replace With:
--------------------------------------------------------------------------------
        echo '<tr bgcolor="'.$altbg2.'" class="ctrtablerow"><td>'.$lang['themeupdate'].'</td></tr>';
        redirect($full_url.'cp2.php?action=themes', 1.5, X_REDIRECT_JS);
--------------------------------------------------------------------------------

END OF HACK !