============================================================================================================================
Modification Name: Job Application

Version: 2.0

Description:
This is an application form you can use to make your members apply to join the staff team of your forum.
You can choose to accept or reject them by viewing their applications.
Every member will have a passcode they will receive by email when they apply.

In the Admin view ....
When you accept someone you can choose the rank (Moderator, Super Moderator, Administrator, Super Administrator) for this member depending on the job they select. 
Under settings you can turn the link to apply for a staff position to 'off' or 'on'.

This also has an option to play a sound notification when new applications are received. It will play one sound for 1 application and another sound for 2 or more applications.

Compatibility: XMB 1.9.5 SP1

Code Designed By: FREEWILL46

Updated for 1.9.5 By: WormHole and GuldantheWarlock @ XMB Garage

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

Upload application.php, application_admin.php, application_class.php, install.php and application.xmb to your forum directory.
These are located in the files folder within the Contents folder.

Upload the image apply.gif to your theme folders.
If using the sound notification upload newapp1.mp3 and newapp2.mp3 to your forum images directory.
These are located in the images folder within the Contents folder.

RUN: install.php from your forum directory.

============================================================================================================================
=======
Step 2:
=======
================
Edit File: config.php
================
==========
Find Code:
==========

    $ipreg = 'on';

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

    // Job Application Mod Begin
    define('APP_INPUT', 0);
    define('APP_TEXTAREA', 1);
    define('APP_RADIO', 2);
    define('APP_SELECT', 3);
    // Job Application Mod End

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

        $avataron = $avataroff = $avatarlist = '';
        if ($SETTINGS['avastatus'] == "on") {
            $avataron = $selHTML;
        } elseif ($avastatus == "list") {
            $avatarlist = $selHTML;
        } else {
            $avataroff = $selHTML;
        }

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

        // Job Application Mod Begin
        $appjoinon = $appjoinoff = '';
        switch ($SETTINGS['appjoin']) {
            case 'on':
                $appjoinon = $selHTML;
                break;
            default:
                $appjoinoff = $selHTML;
                break;
        }
        // Job Application Mod End

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

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

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

        // Job Application Mod Begin
        printsetting1($lang['jobapp'], 'appjoinnew', $appjoinon, $appjoinoff, $langfile);
        // Job Application Mod End

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

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

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

        // Job Application Mod Begin
        $appjoinnew = ($appjoinnew == 'on') ? 'on' : 'off';
        // Job Application Mod End

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

$db->query("UPDATE $table_settings SET langfile='$langfilenew'

==============================
Add To End Of Statement BEFORE  ");
==============================

, appjoin='$appjoinnew'

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

$tables = array(

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

$tables = array('application','application_settings','application_field','application_field_data',

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

// 'Forum Rules'-link
if ($SETTINGS['bbrules'] == "on") {
    $links[] = "<a href=\"faq.php?page=forumrules\"><font class=\"navtd\">$lang[textbbrules]</font></a>";
}

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

// Job Application-link
if ($SETTINGS['appjoin'] == 'on') {
    $links[] = "<img src=\"$imgdir/apply.gif\" title=\"$lang[appjoin]\" alt=\"$lang[appjoin]\" border=\"0\" /> <a href=\"application.php\"><font class=\"navtd\">$lang[appjoin]</font></a>";
}

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

// if the user is registered, check for new u2u's
$newu2umsg = '';
if (X_MEMBER) {
    $query = $db->query("SELECT COUNT(readstatus) FROM $table_u2u WHERE owner='$self[username]' AND folder='Inbox' AND readstatus='no'");
    $newu2unum = $db->result($query, 0);
    if ($newu2unum > 0) {
        $newu2umsg = "<a href=\"#\" onclick=\"Popup('u2u.php', 'Window', 700, 450);\">$lang[newu2u1] $newu2unum $lang[newu2u2]</a>";
    }
}

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

// Job Application Mod Begin
$totalnew = '';
if (X_ADMIN) {
    $apptotal = $db->result($db->query("SELECT COUNT(aid) FROM $table_application WHERE status='New'"), 0);
    if ($apptotal != 0) {
        $totalnew = "<br /><img src=\"$imgdir/apply.gif\" alt=\"Job Application Alert\" border=\"0\" /> <a target=\"_blank\" href=\"application_admin.php?action=adminview\">$lang[appuhave] $apptotal $lang[application]</a>";
    }
    if ($apptotal > 1) {
        $totalnew = "<br /><img src=\"$imgdir/apply.gif\" alt=\"Job Application Alert\" border=\"0\" /> <a target=\"_blank\" href=\"application_admin.php?action=adminview\">$lang[appuhave] $apptotal $lang[applications]</a>";
    }
}
// Job Application Mod End

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

For a sound notification of new applications use the code below instead of the code above

// Job Application Mod Begin
$totalnew = $appsound = '';
if (X_ADMIN) {
    $apptotal = $db->result($db->query("SELECT COUNT(aid) FROM $table_application WHERE status='New'"), 0);
    if ($apptotal != 0) {
        $applang  = ($apptotal > 1) ? $lang['applications'] : $lang['application'];
        $totalnew = "<br /><img src=\"$imgdir/apply.gif\" alt=\"Job Application Alert\" border=\"0\" /> <a target=\"_blank\" href=\"application_admin.php?action=adminview\">$lang[appuhave] $apptotal $applang</a>";
    }
}
// Job Application Mod End

============================================================================================================================
=======
Step 5:
=======
=============================================
For a sound notification of new applications use the code below.
=============================================
===============
Edit File: index.php
===============
==========
Find Code:
==========

eval('echo "'.template('header').'";');

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

// Job Application Mod Begin
if ($apptotal != 0) {
    $appsnd    = ($apptotal > 1) ? 'newapp2.mp3' : 'newapp1.mp3';
    $appsound  = "<embed src=\"images/".$appsnd."\" border=\"0\" CONTROLLER=\"false\" WIDTH=\"1\" and HEIGHT=\"1\" hidden=\"true\">";
    $totalnew .= $appsound;
}
// Job Application Mod End

============================================================================================================================
=======
Step 6:
=======
===========================
Edit File: include/admin.user.inc.php
===========================
==========
Find Code:
==========

    &raquo;&nbsp;<a href="cp.php?action=ipban"><?php echo $lang['textipban']?></a><br />

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

    <!-- Job Application Mod Begin -->
    &raquo;&nbsp;<a href="application_admin.php"><?php echo $lang['jobapp']?></a><br />
    <!-- Job Application Mod End -->

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

// Job Application Mod Begin
$lang['Input'] = 'Text Box';
$lang['Textarea'] = 'Text area';
$lang['Radio'] = 'Radio Buttons';
$lang['Select'] = 'Selection Menu';
$lang['jobapp'] = "Job Applications";
$lang['appjoin'] = "Join Staff";
$lang['appmessage'] = "Below is a list of all current applications for a position on the $bbname team and their status.<br><b>Note</b>: $bbname has the right to refuse an application without explanation.";
$lang['appusername'] = "Username:";
$lang['appaplaiedfor'] = "Position Applied For:";
$lang['appuserstatus'] = "Status:";
$lang['appapply'] = "Application Form";
$lang['appnoresults']  = "There are no applicants added yet";
$lang['appinfo'] = "To Apply for a staff position, please fill in the application below.";
$lang['appemailaddress'] = "E-Mail Address:";
$lang['appselect'] = "--SELECT--";
$lang['appiwantjobas'] = "I want to join as a:";
$lang['appdoyouhave'] = "Do You Have a website?  If yes, tell us where:";
$lang['appshowcods'] = "Show us some of your previous work (graphics, php programs, hacks, stuff!)";
$lang['appwhytobecome'] = "Why Do You Want To Become a Part of the $bbname Team?";
$lang['appreset'] = "Reset";
$lang['appsubmit'] = "Submit";
$lang['appnamexists'] = "This username has already submitted an application. You can't use the same username";
$lang['appemailexists'] = "This email already exists. Please choose another email";
$lang['appthanks'] = "Thank you for spending the time to complete this application!  <br />Once you have sent this to our database its progress can be monitored at any time by going to our application tracker.<br />Please remember your unique application ID number - this must be used in the case of a follow-up by Staff.";
$lang['appnoname'] = "You must enter your username";
$lang['appnoemail'] = "You must enter your E-mail address ";
$lang['appnoexpirence'] = "You have to select your past experience";
$lang['appnoposition'] = "You have to select the job you are applying for";
$lang['appnosqlkno'] = "You have to select your sql knowledge";
$lang['appnoxmbknow'] = "You have to select your xmb knowledge";
$lang['appaplyformadded'] = "Your application has been added successfully!";
$lang['appreviewinfo'] = "In order to review this application, please enter in your authorization code you received in your email.";
$lang['appauthorization'] = "Authorization Code Required";
$lang['appinvalidcode'] = "Invalid Authorization Code";
$lang['appuseremail'] = "E-Mail:";
$lang['appuserwebsite'] = "Website:";
$lang['appuserinfo'] = "Application Information";
$lang['appuserid'] = "Application ID";
$lang['appuserapstatus'] = "Status of Application:";
$lang['appadminnotice'] = "Administrator's Notice";
$lang['appusercodechange'] = "Enter Passcode to update application:";
$lang['appcodesubmit'] = "Update Code";
$lang['apppreview'] = "Application Review";
$lang['appnewcodeupdated'] = "Your Passcode has been updated successfully!";
$lang['applicationerror'] = "Application Error";
$lang['applicationconfirm'] = "Application Confirm";
$lang['appadminreview'] = "Admin Review";
$lang['appaccept'] = "Accepted";
$lang['appreject'] = "Rejected";
$lang['appinding'] = "Pending";
$lang['appadminoption'] = "Admin Application Options";
$lang['appsubmitchanges'] = "Submit Changes";
$lang['appadminoptionupdated'] = "All Options have been updated successfully!";
$lang['adminviewpanel'] = "Admin Review Manager";
$lang['appuserinfo'] = "Applicant Information";
$lang['adminnotice'] = "Write notice to Applicant";
$lang['adminsetchosen'] = "Applicant Status Set";
$lang['application'] = "New Application";
$lang['applications'] = "New applications";
$lang['appuhave'] = "You have";
$lang['appsettings'] = "Settings";
$lang['appadminview'] = "Application - Admin View";
$lang['appadminsettings'] = "Application - Admin settings";
$lang['appstatus'] = "Application Status";
$lang['appenabled'] = "Enabled";
$lang['appdisabled'] = "Disabled";
$lang['appaboutyou'] = "About Yourself";
$lang['jobselectapp'] = "Job Select text";
$lang['allappinfo'] = "<b>Note</b>:You have to separate each one with a comma. EX: (1,2,3,4,5)";
$lang['appsubmitchanges'] = "Submit Changes";
$lang['appundochanges'] = "Undo Changes";
$lang['appsubmitdate'] = "Date Submitted";
$lang['appyouarenregisterd'] = "Sorry! Only Registered Members can apply to join the Staff&nbsp;<a href=\"member.php?action=reg\">click here</a>&nbsp;to register now";
$lang['appalreadyadded'] = "Sorry! You can't apply twice";
$lang['apphasdis'] = "Sorry! The Application Form Is Currently Disabled ..Check Back Later";
$lang['adselecstatus'] = "If the Applicant is accepted select a status";
$lang['appyselectstatus'] = "You have to select a Status for this Applicant";
$lang['appycantaddstatus'] = "ERROR! You can't set Status for Member - you didn't accept them!";
$lang['jobappnonstaffreset'] = "All Non-Staff Job Application Statuses have been reset.";
$lang['jobapprejectclear'] = "All Rejected Applications have been cleared.";
$lang['appfieldadded'] = "Field has been added.";
$lang['appfieldedited'] = "Field has been edited.";
$lang['appfielddeleted'] = "Field has been deleted.";
$lang['appsettingsupdated'] = "Settings have been updated.";
$lang['appdeletesuccessful'] = "Application has been deleted successfully.";
$lang['appfieldorderupdated'] = "Field Order Has been Updated .....";
$lang['resetstaffstatus'] = "Reset Staff Status";
$lang['clearrejectapps'] = "Clear Rejected Apps";
$lang['appspending'] = "Pending Applications";
$lang['appsoverview'] = "Overview of Applications";
$lang['appfieldmgmt'] = "Application Field Management";
$lang['appfieldtitle'] = "Field Title";
$lang['appfieldtype'] = "Type";
$lang['appfieldtypeset'] = "<strong>Field Type:</strong><br /><span>Select The field type </span>";
$lang['appfieldorder'] = "Field Order";
$lang['appfieldorderset'] = "<strong>Field Order:</strong><br /><span>Set Here the display Order of the Field (1,2,3) If you have more than one </span>";
$lang['appfieldoption'] = "Option";
$lang['appfieldaddnew'] = "Add New Field";
$lang['appfieldorderupdate'] = "Update Field Order";
$lang['appreview'] = "Review";
$lang['appfieldname'] = "<strong>Field Name:</strong><br /><span>This is the name of the field, for example (Gender)</span>";
$lang['appfielddescr'] = "<strong>Field Description:</strong><br /><span>This is a description of the field, for example (Select Your Gender) </span>";
$lang['appfieldtypesel'] = "<strong>Field Type:</strong><br /><span>Select the field type </span>";
$lang['appfielddata'] = "<strong>Field Data:</strong><br /><span>Enter the options that the user can choose from. <br />Separate each option with a new-line (carriage return). </span>";
// Job Application Mod End

============================================================================================================================
=======
Step 8:
=======
===================
Edit File: viewthread.php
===================
==========
Find Code:
==========

        $date = gmdate($dateformat, $post['dateline'] + $tmoffset);

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

        // Job Application Mod Begin
        $staffstat = '';
        if ($post['staff'] != '') {
            $staffstat = "<br /><font class=\"smalltxt\"><strong>Position:&nbsp;</strong>$post[staff]</font><br />";
        }
        // Job Application Mod End

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

            $location = '';
            $mood = '';

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

            // Job Application Mod Begin
            $staffstat = '';
            // Job Application Mod End

============================================================================================================================
=======
Step 9:
=======
===============================
Go To Administration Panel --> Templates
===============================
=================
Edit Template: header
=================
==========
Find Code:
==========

$newu2umsg

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

$totalnew

============================================================================================================================
========
Step 10:
========
========================
Edit Template: viewthread_post
========================
==========
Find Code:
==========

$showtitle

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

$staffstat

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

Now upload all edited files.
Delete install.php and application.xmb from your board folder.

You're done.

If you have an errors after installing please make a test application and see if that clears it up.

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