Skip to content
Snippets Groups Projects
  • Thane de Loth's avatar
    7042e6c8
    Adopt translation work from Thane de Loth · 7042e6c8
    Thane de Loth authored
    Multilanguage Support via gettext
    
    - added gettext encapsulations to all texts i thought necessary
    - added fallback function for the case that the gettext extension isn't loaded
    - added browser language detection
    - added gettext to the list of optional extensions in setup
    - rewritten some of the texts to use sprintf instead of appending strings
    - added german translation file
    - removed mark_overdue-confirm from cannedresponses.inc.php
    
    extend multi language support and a fex fixes
    
    - Better detection of translation files
    - Added functionality to redirect language codes (see redirecting
    language codes)
    - Ticket Status can be translated
    - The Datepicker can be translated
    - Extended functionality of 'testlang.php' to show what language code is
    used to translate
    
    Forgotten to apply a patch from RC5 to RC6
    
    - Forgotten to change $var to $vars in line 380 of class.mailfetch.php
    - Removed unneeded comment
    
    Added php_gettext as primary translation engine
    
    - Added php_gettext support (thanks to Danilo Segan and Steven
    Armstrong)
    - php_gettext is now the primary translation engine
    - Extended language detection functionality
    
    Add error/misconfiguration checks and fix undefined variables
    7042e6c8
    History
    Adopt translation work from Thane de Loth
    Thane de Loth authored
    Multilanguage Support via gettext
    
    - added gettext encapsulations to all texts i thought necessary
    - added fallback function for the case that the gettext extension isn't loaded
    - added browser language detection
    - added gettext to the list of optional extensions in setup
    - rewritten some of the texts to use sprintf instead of appending strings
    - added german translation file
    - removed mark_overdue-confirm from cannedresponses.inc.php
    
    extend multi language support and a fex fixes
    
    - Better detection of translation files
    - Added functionality to redirect language codes (see redirecting
    language codes)
    - Ticket Status can be translated
    - The Datepicker can be translated
    - Extended functionality of 'testlang.php' to show what language code is
    used to translate
    
    Forgotten to apply a patch from RC5 to RC6
    
    - Forgotten to change $var to $vars in line 380 of class.mailfetch.php
    - Removed unneeded comment
    
    Added php_gettext as primary translation engine
    
    - Added php_gettext support (thanks to Danilo Segan and Steven
    Armstrong)
    - php_gettext is now the primary translation engine
    - Extended language detection functionality
    
    Add error/misconfiguration checks and fix undefined variables
emails.php 3.43 KiB
<?php
/*********************************************************************
    emails.php

    Emails

    Peter Rotich <peter@osticket.com>
    Copyright (c)  2006-2013 osTicket
    http://www.osticket.com

    Released under the GNU General Public License WITHOUT ANY WARRANTY.
    See LICENSE.TXT for details.

    vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
require('admin.inc.php');
include_once(INCLUDE_DIR.'class.email.php');

$email=null;
if($_REQUEST['id'] && !($email=Email::lookup($_REQUEST['id'])))
    $errors['err']=__('Unknown or invalid email ID.');

if($_POST){
    switch(strtolower($_POST['do'])){
        case 'update':
            if(!$email){
                $errors['err']=__('Unknown or invalid email.');
            }elseif($email->update($_POST,$errors)){
                $msg=__('Email updated successfully');
            }elseif(!$errors['err']){
                $errors['err']=__('Error updating email. Try again!');
            }
            break;
        case 'create':
            if(($id=Email::create($_POST,$errors))){
                $msg=__('Email address added successfully');
                $_REQUEST['a']=null;
            }elseif(!$errors['err']){
                $errors['err']=__('Unable to add email. Correct error(s) below and try again.');
            }
            break;
        case 'mass_process':
            if(!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
                $errors['err'] = __('You must select at least one email address');
            } else {
                $count=count($_POST['ids']);

                $sql='SELECT count(dept_id) FROM '.DEPT_TABLE.' dept '
                    .' WHERE email_id IN ('.implode(',', db_input($_POST['ids'])).') '
                    .' OR autoresp_email_id IN ('.implode(',', db_input($_POST['ids'])).')';

                list($depts)=db_fetch_row(db_query($sql));
                if($depts>0) {
                    $errors['err'] = __('One or more of the selected emails is being used by a department. Remove association first!');
                } elseif(!strcasecmp($_POST['a'], 'delete')) {
                    $i=0;
                    foreach($_POST['ids'] as $k=>$v) {
                        if($v!=$cfg->getDefaultEmailId() && ($e=Email::lookup($v)) && $e->delete())
                            $i++;
                    }

                    if($i && $i==$count)
                        $msg = __('Selected emails deleted successfully');
                    elseif($i>0)
                        $warn = sprintf(__('%1$d of %2$d selected emails deleted'), $i, $count);
                    elseif(!$errors['err'])
                        $errors['err'] = __('Unable to delete selected emails');

                } else {
                    $errors['err'] = __('Unknown action - get technical help');
                }
            }
            break;
        default:
            $errors['err'] = __('Unknown action/command');
            break;
    }
}

$page='emails.inc.php';
$tip_namespace = 'emails.email';
if($email || ($_REQUEST['a'] && !strcasecmp($_REQUEST['a'],'add'))) {
    $page='email.inc.php';
}

$nav->setTabActive('emails');
$ost->addExtraHeader('<meta name="tip-namespace" content="' . $tip_namespace . '" />',
    "$('#content').data('tipNamespace', '".$tip_namespace."');");
require(STAFFINC_DIR.'header.inc.php');
require(STAFFINC_DIR.$page);
include(STAFFINC_DIR.'footer.inc.php');
?>