Example #1
0
    define('TICKET_RESPONSE_TABLE',TABLE_PREFIX.'ticket_response');
    define('TICKET_ATTACHMENT_TABLE',TABLE_PREFIX.'ticket_attachment');
    define('TICKET_PRIORITY_TABLE',TABLE_PREFIX.'ticket_priority');
    define('TICKET_LOCK_TABLE',TABLE_PREFIX.'ticket_lock');
  
    define('EMAIL_TABLE',TABLE_PREFIX.'email');
    define('EMAIL_TEMPLATE_TABLE',TABLE_PREFIX.'email_template');
    define('BANLIST_TABLE',TABLE_PREFIX.'email_banlist');
    define('API_KEY_TABLE',TABLE_PREFIX.'api_key');
    define('TIMEZONE_TABLE',TABLE_PREFIX.'timezone'); 
   
    #Connect to the DB && get configuration from database
    $ferror=null;
    if (!db_connect(DBHOST,DBUSER,DBPASS) || !db_select_database(DBNAME)) {
        $ferror='Unable to connect to the database';
    }elseif(!($cfg=Sys::getConfig())){
        $ferror='Unable to load config info from DB. Get tech support.';
    }elseif(!ini_get('short_open_tag')) {
        $ferror='Short open tag disabled! - osTicket requires it turned ON.';
    }

    if($ferror){ //Fatal error
        Sys::alertAdmin('osTicket Fatal Error',$ferror); //try alerting admin.
        die("<b>Fatal Error:</b> Contact system adminstrator."); //Generic error.
        exit;
    }
    //Init
    $cfg->init();
    //Set default timezone...staff will overwrite it.
    $_SESSION['TZ_OFFSET']=$cfg->getTZoffset();
    $_SESSION['daylight']=$cfg->observeDaylightSaving();
Example #2
0
    Copyright (c)  2012-2014 Katak Support
    http://www.katak-support.com/
    
    Released under the GNU General Public License WITHOUT ANY WARRANTY.
    Derived from osTicket v1.6 by Peter Rotich.
    See LICENSE.TXT for details.

    $Id: $
**********************************************************************/
require_once '../main.inc.php';
if (!defined('INCLUDE_DIR')) {
    die('Fatal error!');
}
// TODO: the following lines were introduced to have the traslation during staff login. Find a better solution!
// set staff/admin language and language domain
$cfig = Sys::getConfig();
$lang = $cfig->getStaffLanguage();
putenv('LC_MESSAGES=' . $lang);
setlocale(LC_MESSAGES, $lang);
bindtextdomain('messages', '../i18n');
bind_textdomain_codeset('messages', 'UTF-8');
textdomain("messages");
$msg = $_SESSION['_staff']['auth']['msg'];
$msg = isset($msg) ? $msg : _('Authentication Required');
if ($_POST && (!empty($_POST['username']) && !empty($_POST['passwd']))) {
    //$_SESSION['_staff']=array(); #Uncomment to disable login strikes.
    $msg = _('Invalid login');
    if ($_SESSION['_staff']['laststrike']) {
        if (time() - $_SESSION['_staff']['laststrike'] < $cfg->getStaffLoginTimeout()) {
            $msg = _('Excessive failed login attempts');
            $errors['err'] = _('You\'ve reached maximum failed login attempts allowed.');