diff --git a/attachment.php b/attachment.php index d780ae2d..dee00b02 100644 --- a/attachment.php +++ b/attachment.php @@ -1,36 +1,36 @@ - - 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('secure.inc.php'); -require_once(INCLUDE_DIR.'class.attachment.php'); -//Basic checks -if(!$thisclient - || !$_GET['id'] - || !$_GET['h'] - || !($attachment=Attachment::lookup($_GET['id'])) - || !($file=$attachment->getFile())) - die('Unknown attachment!'); - -//Validate session access hash - we want to make sure the link is FRESH! and the user has access to the parent ticket!! -$vhash=md5($attachment->getFileId().session_id().$file->getHash()); -if(strcasecmp(trim($_GET['h']),$vhash) - || !($ticket=$attachment->getTicket()) - || !$ticket->checkClientAccess($thisclient)) - die('Unknown or invalid attachment'); -//Download the file.. -$file->download(); - -?> + + 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('secure.inc.php'); +require_once(INCLUDE_DIR.'class.attachment.php'); +//Basic checks +if(!$thisclient + || !$_GET['id'] + || !$_GET['h'] + || !($attachment=Attachment::lookup($_GET['id'])) + || !($file=$attachment->getFile())) + die(__('Unknown attachment!')); + +//Validate session access hash - we want to make sure the link is FRESH! and the user has access to the parent ticket!! +$vhash=md5($attachment->getFileId().session_id().$file->getHash()); +if(strcasecmp(trim($_GET['h']),$vhash) + || !($ticket=$attachment->getTicket()) + || !$ticket->checkClientAccess($thisclient)) + die(__('Unknown or invalid attachment')); +//Download the file.. +$file->download(); + +?> diff --git a/include/ajax.content.php b/include/ajax.content.php index c9c6b7d7..7c5df6e1 100644 --- a/include/ajax.content.php +++ b/include/ajax.content.php @@ -22,13 +22,13 @@ function log($id) { if($id && ($log=Log::lookup($id))) { $content=sprintf('
 %s

%s

-
Log Date: %s IP Address: %s
', +
Log Date: %s '.__('IP Address').': %s', $log->getTitle(), Format::display(str_replace(',',', ',$log->getText())), Format::db_daydatetime($log->getCreateDate()), $log->getIP()); }else { - $content='
 Error:Unknown or invalid log ID
'; + $content='
 '.__('Error').':'.__('Unknown or invalid log ID').'
'; } return $content; @@ -38,45 +38,45 @@ function ticket_variables() { $content='
-

Ticket Variables

- Please note that non-base variables depends on the context of use. Visit osTicket Wiki for up to date documentation. +

'.__('Ticket Variables').'

+ '.__('Please note that non-base variables depends on the context of use. Visit osTicket Wiki for up to date documentation.').'
- + diff --git a/include/ajax.kbase.php b/include/ajax.kbase.php index a89161a7..944e5888 100644 --- a/include/ajax.kbase.php +++ b/include/ajax.kbase.php @@ -62,9 +62,9 @@ function faq($id, $format='html') { $resp = sprintf( '
%s

%s

-
Last updated %s
+
'.__('Last updated %s').'

- View | Attachments (%s)', + '.__('View').' | '.__('Attachments').' (%s)', $faq->getQuestion(), Format::safe_html($faq->getAnswer()), Format::db_daydatetime($faq->getUpdateDate()), @@ -72,7 +72,7 @@ function faq($id, $format='html') { $faq->getId(), $faq->getNumAttachments()); if($thisstaff && $thisstaff->canManageFAQ()) { - $resp.=sprintf(' | Edit',$faq->getId()); + $resp.=sprintf(' | '.__('Edit').'',$faq->getId()); } $resp.='
'; diff --git a/include/ajax.reports.php b/include/ajax.reports.php index 2634bc8d..3c28ca33 100644 --- a/include/ajax.reports.php +++ b/include/ajax.reports.php @@ -28,10 +28,10 @@ */ class OverviewReportAjaxAPI extends AjaxController { function enumTabularGroups() { - return $this->encode(array("dept"=>"Department", "topic"=>"Topics", + return $this->encode(array("dept"=>__("Department"), "topic"=>__("Topics"), # XXX: This will be relative to permissions based on the # logged-in-staff. For basic staff, this will be 'My Stats' - "staff"=>"Staff")); + "staff"=>__("Staff"))); } function getData() { @@ -55,7 +55,7 @@ function getData() { "pk" => "dept_id", "sort" => 'T1.dept_name', "fields" => 'T1.dept_name', - "headers" => array('Department'), + "headers" => array(__('Department')), "filter" => ('T1.dept_id IN ('.implode(',', db_input($thisstaff->getDepts())).')') ), "topic" => array( @@ -65,7 +65,7 @@ function getData() { "fields" => "CONCAT_WS(' / '," ."(SELECT P.topic FROM ".TOPIC_TABLE." P WHERE P.topic_id = T1.topic_pid)," ."T1.topic) as name ", - "headers" => array('Help Topic'), + "headers" => array(__('Help Topic')), "filter" => '1' ), "staff" => array( @@ -73,7 +73,7 @@ function getData() { "pk" => 'staff_id', "sort" => 'name', "fields" => "CONCAT_WS(' ', T1.firstname, T1.lastname) as name", - "headers" => array('Staff Member'), + "headers" => array(__('Staff Member')), "filter" => ('T1.staff_id=S1.staff_id AND @@ -153,8 +153,8 @@ function getData() { $r[] = null; } return array("columns" => array_merge($info['headers'], - array('Opened','Assigned','Overdue','Closed','Reopened', - 'Service Time','Response Time')), + array(__('Opened'),__('Assigned'),__('Overdue'),__('Closed'),__('Reopened'), + __('Service Time'),__('Response Time'))), "data" => $rows); } @@ -168,7 +168,7 @@ function downloadTabularData() { foreach ($data['data'] as $row) $csv .= "\n" . '"' . implode('","', $row) . '"'; Http::download( - sprintf('%s-report.csv', $this->get('group', 'Department')), + sprintf('%s-report.csv', $this->get('group', __('Department'))), 'text/csv', $csv); } diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php index 34c46325..d7ad0e32 100644 --- a/include/ajax.tickets.php +++ b/include/ajax.tickets.php @@ -178,13 +178,13 @@ function search() { $sql="$select $from $where"; if(($tickets=db_result(db_query($sql)))) { - $result['success'] =sprintf("Search criteria matched %s - view", + $result['success'] =sprintf(__("Search criteria matched %s")." - ".__('view')."", ($tickets>1?"$tickets tickets":"$tickets ticket"), str_replace(array('&', '&'), array('&', '&'), $_SERVER['QUERY_STRING'])); } else { - $result['fail']='No tickets found matching your search criteria.'; + $result['fail']=__('No tickets found matching your search criteria.'); } - + return $this->json_encode($result); } @@ -195,14 +195,14 @@ function acquireLock($tid) { return 0; if(!($ticket = Ticket::lookup($tid)) || !$ticket->checkStaffAccess($thisstaff)) - return $this->json_encode(array('id'=>0, 'retry'=>false, 'msg'=>'Lock denied!')); + return $this->json_encode(array('id'=>0, 'retry'=>false, 'msg'=>__('Lock denied!'))); //is the ticket already locked? if($ticket->isLocked() && ($lock=$ticket->getLock()) && !$lock->isExpired()) { /*Note: Ticket->acquireLock does the same logic...but we need it here since we need to know who owns the lock up front*/ //Ticket is locked by someone else.?? if($lock->getStaffId()!=$thisstaff->getId()) - return $this->json_encode(array('id'=>0, 'retry'=>false, 'msg'=>'Unable to acquire lock.')); + return $this->json_encode(array('id'=>0, 'retry'=>false, 'msg'=>__('Unable to acquire lock.'))); //Ticket already locked by staff...try renewing it. $lock->renew(); //New clock baby! @@ -266,10 +266,10 @@ function previewTicket ($tid) { $error=$msg=$warn=null; if($lock && $lock->getStaffId()==$thisstaff->getId()) - $warn.=' Ticket is locked by '.$lock->getStaffName().''; + $warn.=' '.sprintf(__('Ticket is locked by %s'),$lock->getStaffName()).''; elseif($ticket->isOverdue()) - $warn.=' Marked overdue!'; - + $warn.=' '.__('Marked overdue!').''; + ob_start(); echo sprintf( '
@@ -283,29 +283,39 @@ function previewTicket ($tid) { echo sprintf('
%s
',$warn); echo '
Base VariablesOther Variables
'.__('Base Variables').''.__('Other Variables').'
- - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + +
%{ticket.id}Ticket ID (internal ID)
%{ticket.number}Ticket number (external ID)
%{ticket.email}Email address
%{ticket.name}Full name
%{ticket.subject}Subject
%{ticket.phone}Phone number | ext
%{ticket.status}Status
%{ticket.priority}Priority
%{ticket.assigned}Assigned staff and/or team
%{ticket.create_date}Date created
%{ticket.due_date}Due date
%{ticket.close_date}Date closed
%{ticket.auth_token}Auth. token used for auto-login
%{ticket.client_link}Client\'s ticket view link
%{ticket.staff_link}Staff\'s ticket view link
Expandable Variables (See Wiki)
%{ticket.topic}Help topic
%{ticket.dept}Department
%{ticket.staff}Assigned/closing staff
%{ticket.team}Assigned/closing team
%{ticket.id}'.__('Ticket ID').' ('.__('internal ID').')
%{ticket.number}'.__('Ticket number').' ('.__('external ID').')
%{ticket.email}'.__('Email address').'
%{ticket.name}'.__('Full name').'
%{ticket.subject}'.__('Subject').'
%{ticket.phone}'.__('Phone number | ext').'
%{ticket.status}'.__('Status').'
%{ticket.priority}'.__('Priority').'
%{ticket.assigned}'.__('Assigned staff and/or team').'
%{ticket.create_date}'.__('Date created').'
%{ticket.due_date}'.__('Due date').'
%{ticket.close_date}'.__('Date closed').'
%{ticket.auth_token}'.__('Auth. token used for auto-login').'
%{ticket.client_link}'.__('Client\'s ticket view link').'
%{ticket.staff_link}'.__('Staff\'s ticket view link').'
'.__('Expandable Variables (See Wiki)').'
%{ticket.topic}'.__('Help topic').'
%{ticket.dept}'.__('Department').'
%{ticket.staff}'.__('Assigned/closing staff').'
%{ticket.team}'.__('Assigned/closing team').'
- - - - - - - + + + + + + +
%{message}Incoming message
%{response}Outgoing response
%{comments}Assign/transfer comments
%{note}Internal note (expandable)
%{assignee}Assigned staff/team
%{assigner}Staff assigning the ticket
%{url}osTicket\'s base url (FQDN)
%{message}'.__('Incoming message').'
%{response}'.__('Outgoing response').'
%{comments}'.__('Assign/transfer comments').'
%{note}'.__('Internal note (expandable)').'
%{assignee}'.__('Assigned staff/team').'
%{assigner}'.__('Staff assigning the ticket').'
%{url}'.__('osTicket\'s base url (FQDN)').'
'; - - $ticket_state=sprintf('%s',ucfirst($ticket->getStatus())); + $ticketstatus=''; + switch($ticket->getStatus()) { + case 'open': + $ticketstatus=__('open'); + break; + case 'closed': + $ticketstatus=__('closed'); + break; + default: + $ticketstatus=__('open'); + } + $ticket_state=sprintf('%s',ucfirst($ticketstatus)); if($ticket->isOpen()) { if($ticket->isOverdue()) - $ticket_state.=' — Overdue'; + $ticket_state.=' — '.__('Overdue').''; else $ticket_state.=sprintf(' — %s',$ticket->getPriority()); } echo sprintf(' - + - + ',$ticket_state, Format::db_datetime($ticket->getCreateDate())); if($ticket->isClosed()) { echo sprintf(' - + ', Format::db_datetime($ticket->getCloseDate()), @@ -314,7 +324,7 @@ function previewTicket ($tid) { } elseif($ticket->getEstDueDate()) { echo sprintf(' - + ', Format::db_datetime($ticket->getEstDueDate())); @@ -327,21 +337,21 @@ function previewTicket ($tid) { if($ticket->isOpen()) { echo sprintf(' - + - ',$ticket->isAssigned()?implode('/', $ticket->getAssignees()):' — Unassigned —'); + ',$ticket->isAssigned()?implode('/', $ticket->getAssignees()):' — '.__('Unassigned').' —'); } echo sprintf( ' - + - + - + ', Format::htmlchars($ticket->getDeptName()), @@ -350,23 +360,23 @@ function previewTicket ($tid) { $ticket->getEmail()); echo '
Ticket State:'.__('Ticket State').': %s
Create Date:'.__('Create Date').': %s
Close Date:'.__('Close Date').': %s by %s
Due Date:'.__('Due Date').': %s
Assigned To:'.__('Assigned To').': %s
Department:'.__('Department').': %s
Help Topic:'.__('Help Topic').': %s
From:'.__('From').': %s %s
'; - $options[]=array('action'=>'Thread ('.$ticket->getThreadCount().')','url'=>"tickets.php?id=$tid"); + $options[]=array('action'=>__('Thread').' ('.$ticket->getThreadCount().')','url'=>"tickets.php?id=$tid"); if($ticket->getNumNotes()) - $options[]=array('action'=>'Notes ('.$ticket->getNumNotes().')','url'=>"tickets.php?id=$tid#notes"); - + $options[]=array('action'=>__('Notes').' ('.$ticket->getNumNotes().')','url'=>"tickets.php?id=$tid#notes"); + if($ticket->isOpen()) - $options[]=array('action'=>'Reply','url'=>"tickets.php?id=$tid#reply"); + $options[]=array('action'=>__('Reply'),'url'=>"tickets.php?id=$tid#reply"); if($thisstaff->canAssignTickets()) - $options[]=array('action'=>($ticket->isAssigned()?'Reassign':'Assign'),'url'=>"tickets.php?id=$tid#assign"); + $options[]=array('action'=>($ticket->isAssigned()?__('Reassign'):__('Assign')),'url'=>"tickets.php?id=$tid#assign"); if($thisstaff->canTransferTickets()) - $options[]=array('action'=>'Transfer','url'=>"tickets.php?id=$tid#transfer"); + $options[]=array('action'=>__('Transfer'),'url'=>"tickets.php?id=$tid#transfer"); - $options[]=array('action'=>'Post Note','url'=>"tickets.php?id=$tid#note"); + $options[]=array('action'=>__('Post Note'),'url'=>"tickets.php?id=$tid#note"); if($thisstaff->canEditTickets()) - $options[]=array('action'=>'Edit Ticket','url'=>"tickets.php?id=$tid&a=edit"); + $options[]=array('action'=>__('Edit Ticket'),'url'=>"tickets.php?id=$tid&a=edit"); if($options) { echo '
'; + echo '
 '.__('Page').':'.$pageNav->getPageLinks().' 
'; ?>

- - - + + +

'; + echo '
 '.__('Page').':'.$pageNav->getPageLinks().' 
'; ?>

- +    - +    - +

@@ -61,10 +61,10 @@   - href="canned.php?&sort=title">Title - href="canned.php?&sort=status">Status - href="canned.php?&sort=dept">Department - href="canned.php?&sort=updated">Last Updated + href="canned.php?&sort=title"> + href="canned.php?&sort=status"> + href="canned.php?&sort=dept"> + href="canned.php?&sort=updated"> @@ -86,8 +86,8 @@   - Disabled'; ?> - + '.__('Disabled').''; ?> +   - Select:  - All   - None   - Toggle   +   +    +    +    @@ -110,42 +110,39 @@  Page:'.$pageNav->getPageLinks().' '; + echo '
 '.__('Page').':'.$pageNav->getPageLinks().' 
'; ?>

- - - + + +

@@ -55,10 +55,10 @@   - href="categories.php?&sort=name">Name - href="categories.php?&sort=type">Type - href="categories.php?&sort=faqs">FAQs - href="categories.php?&sort=updated">Last Updated + href="categories.php?&sort=name"> + href="categories.php?&sort=type"> + href="categories.php?&sort=faqs"> + href="categories.php?&sort=updated"> @@ -81,7 +81,7 @@ >   - Public':'Internal'; ?> + '.__('Public').'':__('Internal'); ?>   @@ -92,12 +92,12 @@ - Select:  - All   - None   - Toggle   +   +    +    +    @@ -105,39 +105,39 @@  Page:'.$pageNav->getPageLinks().' '; + echo '
 '.__('Page').':'.$pageNav->getPageLinks().' 
'; ?>

- - - + + +

@@ -55,11 +55,11 @@   - href="departments.php?&sort=name">Name - href="departments.php?&sort=type">Type - href="departments.php?&sort=users">Users - href="departments.php?&sort=email">Email Address - href="departments.php?&sort=manager">Dept. Manager + href="departments.php?&sort=name"> + href="departments.php?&sort=type"> + href="departments.php?&sort=users"> + href="departments.php?&sort=email"> + href="departments.php?&sort=manager"> @@ -74,7 +74,7 @@ $sel=true; $row['email']=$row['email_name']?($row['email_name'].' <'.$row['email'].'>'):$row['email']; - $default=($defaultId==$row['dept_id'])?' (Default)':''; + $default=($defaultId==$row['dept_id'])?' ('.__('Default').')':''; ?> @@ -82,7 +82,7 @@ >   - Private'; ?> + '.__('Private').''; ?>    0) { ?> @@ -101,12 +101,12 @@ - Select:  - All   - None   - Toggle   +   +    +    +    @@ -116,9 +116,9 @@ if($res && $num): //Show options.. ?>

- - - + + +

@@ -57,11 +57,11 @@   - href="emails.php?&sort=email">Email - href="emails.php?&sort=priority">Priority - href="emails.php?&sort=dept">Department - href="emails.php?&sort=created">Created - href="emails.php?&sort=updated">Last Updated + href="emails.php?&sort=email"> + href="emails.php?&sort=priority"> + href="emails.php?&sort=dept"> + href="emails.php?&sort=created"> + href="emails.php?&sort=updated"> @@ -97,12 +97,12 @@ - Select:  - All   - None   - Toggle   +   +    +    +    @@ -110,10 +110,10 @@  Page:'.$pageNav->getPageLinks().' '; + echo '
 '.__('Page').':'.$pageNav->getPageLinks().' 
'; ?>

- +

@@ -58,13 +58,13 @@   - href="filters.php?&sort=name">Name - href="filters.php?&sort=status">Status - href="filters.php?&sort=order">Order - href="filters.php?&sort=rules">Rules - href="filters.php?&sort=target">Target - href="filters.php?&sort=created">Date Added - href="filters.php?&sort=updated">Last Updated + href="filters.php?&sort=name"> + href="filters.php?&sort=status"> + href="filters.php?&sort=order"> + href="filters.php?&sort=rules"> + href="filters.php?&sort=target"> + href="filters.php?&sort=created"> + href="filters.php?&sort=updated"> @@ -83,7 +83,7 @@ >   - Disabled'; ?> + '.__('Disabled').''; ?>       @@ -97,12 +97,12 @@ - Select:  - All   - None   - Toggle   +   +    +    +    @@ -110,12 +110,12 @@  Page:'.$pageNav->getPageLinks().' '; + echo '
 '.__('Page').':'.$pageNav->getPageLinks().' 
'; ?>

- - - + + +

- -isStaff()) { ?> -
- - - -
- - -
-
-

Please Wait!

-

Please wait... it will take a second!

-
- - + + +isStaff()) { ?> +
+ + + +
+ + +
+
+

+

+
+ + diff --git a/include/staff/group.inc.php b/include/staff/group.inc.php index bfcc2a59..e9dadcc1 100644 --- a/include/staff/group.inc.php +++ b/include/staff/group.inc.php @@ -3,17 +3,17 @@ $info=array(); $qstr=''; if($group && $_REQUEST['a']!='add'){ - $title='Update Group'; + $title=__('Update Group'); $action='update'; - $submit_text='Save Changes'; + $submit_text=__('Save Changes'); $info=$group->getInfo(); $info['id']=$group->getId(); $info['depts']=$group->getDepartments(); $qstr.='&id='.$group->getId(); }else { - $title='Add New Group'; + $title=__('Add New Group'); $action='create'; - $submit_text='Create Group'; + $submit_text=__('Create Group'); $info['isactive']=isset($info['isactive'])?$info['isactive']:1; $info['can_create_tickets']=isset($info['can_create_tickets'])?$info['can_create_tickets']:1; $qstr.='&a='.$_REQUEST['a']; @@ -25,20 +25,20 @@ -

User Group

+

- + - + ');?> - + - + - + - + - + - + - + - + - + @@ -176,7 +176,7 @@

- Group Information: Disabled group will limit staff members access. Admins are exempted. + :
- Name: + @@ -47,110 +47,110 @@
- Status: + - >Active - >Disabled + > + >  
- Group Permissions: Applies to all group members  + :  
Can Create Tickets
Create Tickets');?> - />Yes + />    - />No -   Ability to open tickets on behalf of clients. + /> +   
Can Edit Tickets
Edit Tickets - />Yes + />    - />No -   Ability to edit tickets. + /> +   
Can Post Reply
Post Reply');?> - />Yes + />    - />No -   Ability to post a ticket reply. + /> +   
Can Close Tickets
Close Tickets');?> - />Yes + />    - />No -   Ability to close tickets. Staff can still post a response. + /> +   
Can Assign Tickets
Assign Tickets');?> - />Yes + />    - />No -   Ability to assign tickets to staff members. + /> +   
Can Transfer Tickets
Transfer Tickets');?> - />Yes + />    - />No -   Ability to transfer tickets between departments. + /> +   
Can Delete Tickets
Delete Tickets');?> - />Yes + />    - />No -   Ability to delete tickets (Deleted tickets can't be recovered!) + /> +   
Can Ban Emails
- />Yes + />    - />No -   Ability to add/remove emails from banlist via ticket interface. + /> +   
Can Manage Premade
- />Yes + />    - />No -   Ability to add/update/disable/delete canned responses and attachments. + /> +   
Can Manage FAQ
- />Yes + />    - />No -   Ability to add/update/disable/delete knowledgebase categories and FAQs. + /> +   
Can View Staff Stats.
- />Yes + />    - />No -   Ability to view stats of other staff members in allowed departments. + /> +   
- Department Access: Check all departments the group members are allowed to access.   Select All  Select None   + :        
- Admin Notes: Internal notes viewable by all admins.  + :  

- - + +

diff --git a/include/staff/groups.inc.php b/include/staff/groups.inc.php index 64ea1a5b..8c6f7ad2 100644 --- a/include/staff/groups.inc.php +++ b/include/staff/groups.inc.php @@ -34,16 +34,16 @@ $query="$sql GROUP BY grp.group_id ORDER BY $order_by"; $res=db_query($query); if($res && ($num=db_num_rows($res))) - $showing="Showing 1-$num of $num groups"; + $showing=sprintf(__('Showing 1-%1$d of %2$d groups'), $num, $num); else - $showing='No groups found!'; + $showing=__('No groups found!'); ?>
-

User Groups

+

- Add New Group
+
@@ -54,12 +54,12 @@   - href="groups.php?&sort=name">Group Name - href="groups.php?&sort=status">Status - href="groups.php?&sort=users">Members - href="groups.php?&sort=depts">Departments - href="groups.php?&sort=created">Created On - href="groups.php?&sort=updated">Last Updated + href="groups.php?&sort=name"> + href="groups.php?&sort=status"> + href="groups.php?&sort=users"> + href="groups.php?&sort=depts"> + href="groups.php?&sort=created"> + href="groups.php?&sort=updated"> @@ -77,7 +77,7 @@ >   -  Disabled'; ?> +  '.__('Disabled').''; ?>    0) { ?> @@ -98,12 +98,12 @@ - Select:  - All   - None   - Toggle   +   +    +    +    @@ -113,9 +113,9 @@ if($res && $num): //Show options.. ?>

- - - + + +


-

Statistics

-

Statistics of tickets organized by department, help topic, and staff.

+

+

diff --git a/scp/departments.php b/scp/departments.php index e0fdf4f7..d5d8c8ef 100644 --- a/scp/departments.php +++ b/scp/departments.php @@ -14,34 +14,35 @@ vim: expandtab sw=4 ts=4 sts=4: **********************************************************************/ require('admin.inc.php'); + $dept=null; if($_REQUEST['id'] && !($dept=Dept::lookup($_REQUEST['id']))) - $errors['err']='Unknown or invalid department ID.'; + $errors['err']=__('Unknown or invalid department ID.'); if($_POST){ switch(strtolower($_POST['do'])){ case 'update': if(!$dept){ - $errors['err']='Unknown or invalid department.'; + $errors['err']=__('Unknown or invalid department.'); }elseif($dept->update($_POST,$errors)){ - $msg='Department updated successfully'; + $msg=__('Department updated successfully'); }elseif(!$errors['err']){ - $errors['err']='Error updating department. Try again!'; + $errors['err']=__('Error updating department. Try again!'); } break; case 'create': if(($id=Dept::create($_POST,$errors))){ - $msg=Format::htmlchars($_POST['name']).' added successfully'; + $msg=sprintf(__('%s added successfully'),Format::htmlchars($_POST['name'])); $_REQUEST['a']=null; }elseif(!$errors['err']){ - $errors['err']='Unable to add department. Correct error(s) below and try again.'; + $errors['err']=__('Unable to add department. 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 department'; + $errors['err'] = __('You must select at least one department'); }elseif(in_array($cfg->getDefaultDeptId(),$_POST['ids'])) { - $errors['err'] = 'You can not disable/delete a default department. Remove default Dept. and try again.'; + $errors['err'] = __('You can not disable/delete a default department. Remove default Dept. and try again.'); }else{ $count=count($_POST['ids']); switch(strtolower($_POST['a'])) { @@ -50,11 +51,11 @@ .' WHERE dept_id IN ('.implode(',', db_input($_POST['ids'])).')'; if(db_query($sql) && ($num=db_affected_rows())){ if($num==$count) - $msg='Selected departments made public'; + $msg=__('Selected departments made public'); else - $warn="$num of $count selected departments made public"; + $warn=sprintf(__('%1$d of %2$d selected departments made public'), $num, $count); } else { - $errors['err']='Unable to make selected department public.'; + $errors['err']=__('Unable to make selected department public.'); } break; case 'make_private': @@ -63,11 +64,11 @@ .' AND dept_id!='.db_input($cfg->getDefaultDeptId()); if(db_query($sql) && ($num=db_affected_rows())) { if($num==$count) - $msg = 'Selected departments made private'; + $msg = __('Selected departments made private'); else - $warn = "$num of $count selected departments made private"; + $warn = sprintf(__('%1$d of %2$d selected departments made private'), $num, $count); } else { - $errors['err'] = 'Unable to make selected department(s) private. Possibly already private!'; + $errors['err'] = __('Unable to make selected department(s) private. Possibly already private!'); } break; case 'delete': @@ -76,7 +77,7 @@ .' WHERE dept_id IN ('.implode(',', db_input($_POST['ids'])).')'; list($members)=db_fetch_row(db_query($sql)); if($members) - $errors['err']='Departments with staff can not be deleted. Move staff first.'; + $errors['err']=__('Departments with staff can not be deleted. Move staff first.'); else { $i=0; foreach($_POST['ids'] as $k=>$v) { @@ -84,20 +85,20 @@ $i++; } if($i && $i==$count) - $msg = 'Selected departments deleted successfully'; + $msg = __('Selected departments deleted successfully'); elseif($i>0) - $warn = "$i of $count selected departments deleted"; + $warn = sprintf(__('%1$d of %2$d selected departments deleted'), $i, $count); elseif(!$errors['err']) - $errors['err'] = 'Unable to delete selected departments.'; + $errors['err'] = __('Unable to delete selected departments.'); } break; default: - $errors['err']='Unknown action - get technical help'; + $errors['err']=__('Unknown action - get technical help'); } } break; default: - $errors['err']='Unknown action/command'; + $errors['err']=__('Unknown action/command'); break; } } diff --git a/scp/emails.php b/scp/emails.php index 7a3051ea..736314ba 100644 --- a/scp/emails.php +++ b/scp/emails.php @@ -18,30 +18,30 @@ $email=null; if($_REQUEST['id'] && !($email=Email::lookup($_REQUEST['id']))) - $errors['err']='Unknown or invalid email ID.'; + $errors['err']=__('Unknown or invalid email ID.'); if($_POST){ switch(strtolower($_POST['do'])){ case 'update': if(!$email){ - $errors['err']='Unknown or invalid email.'; + $errors['err']=__('Unknown or invalid email.'); }elseif($email->update($_POST,$errors)){ - $msg='Email updated successfully'; + $msg=__('Email updated successfully'); }elseif(!$errors['err']){ - $errors['err']='Error updating email. Try again!'; + $errors['err']=__('Error updating email. Try again!'); } break; case 'create': if(($id=Email::create($_POST,$errors))){ - $msg='Email address added successfully'; + $msg=__('Email address added successfully'); $_REQUEST['a']=null; }elseif(!$errors['err']){ - $errors['err']='Unable to add email. Correct error(s) below and try again.'; + $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'; + $errors['err'] = __('You must select at least one email address'); } else { $count=count($_POST['ids']); @@ -51,7 +51,7 @@ 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!'; + $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) { @@ -60,19 +60,19 @@ } if($i && $i==$count) - $msg = 'Selected emails deleted successfully'; + $msg = __('Selected emails deleted successfully'); elseif($i>0) - $warn = "$i of $count selected emails deleted"; + $warn = sprintf(__('%1$d of %2$d selected emails deleted'), $i, $count); elseif(!$errors['err']) - $errors['err'] = 'Unable to delete selected emails'; + $errors['err'] = __('Unable to delete selected emails'); } else { - $errors['err'] = 'Unknown action - get technical help'; + $errors['err'] = __('Unknown action - get technical help'); } } break; default: - $errors['err'] = 'Unknown action/command'; + $errors['err'] = __('Unknown action/command'); break; } } diff --git a/scp/emailtest.php b/scp/emailtest.php index f62bdc6b..3b644ffe 100644 --- a/scp/emailtest.php +++ b/scp/emailtest.php @@ -23,24 +23,24 @@ $errors=array(); $email=null; if(!$_POST['email_id'] || !($email=Email::lookup($_POST['email_id']))) - $errors['email_id']='Select from email address'; + $errors['email_id']=__('Select from email address'); if(!$_POST['email'] || !Validator::is_email($_POST['email'])) - $errors['email']='To email address required'; + $errors['email']=__('To email address required'); if(!$_POST['subj']) - $errors['subj']='Subject required'; + $errors['subj']=__('Subject required'); if(!$_POST['message']) - $errors['message']='Message required'; + $errors['message']=__('Message required'); if(!$errors && $email){ if($email->send($_POST['email'],$_POST['subj'],$_POST['message'])) - $msg='Test email sent successfully to '.Format::htmlchars($_POST['email']); + $msg=sprintf(__('Test email sent successfully to %s'), Format::htmlchars($_POST['email'])); else - $errors['err']='Error sending email - try again.'; + $errors['err']=__('Error sending email - try again.'); }elseif($errors['err']){ - $errors['err']='Error sending email - try again.'; + $errors['err']=__('Error sending email - try again.'); } } $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); @@ -50,23 +50,23 @@ -

Test Outgoing Email

+

- Emails delivery depends on your server settings (php.ini) and/or email SMTP configuration. +
- From: + :
- To: + : @@ -96,7 +96,7 @@
- Subject: + : @@ -105,16 +105,16 @@
- Message: email message to send. 
+ :  

- - - + + +

update($_POST,$errors)) { - $msg='FAQ updated successfully'; + $msg=__('FAQ updated successfully'); $_REQUEST['a']=null; //Go back to view $faq->reload(); } elseif(!$errors['err']) - $errors['err'] = 'Unable to update FAQ. Try again!'; + $errors['err'] = __('Unable to update FAQ. Try again!'); break; case 'manage-faq': if(!$faq) { - $errors['err']='Unknown or invalid FAQ'; + $errors['err']=__('Unknown or invalid FAQ'); } else { switch(strtolower($_POST['a'])) { case 'edit': @@ -54,32 +54,32 @@ break; case 'publish'; if($faq->publish()) - $msg='FAQ published successfully'; + $msg=__('FAQ published successfully'); else - $errors['err']='Unable to publish the FAQ. Try editing it.'; + $errors['err']=__('Unable to publish the FAQ. Try editing it.'); break; case 'unpublish'; if($faq->unpublish()) - $msg='FAQ unpublished successfully'; + $msg=__('FAQ unpublished successfully'); else - $errors['err']='Unable to unpublish the FAQ. Try editing it.'; + $errors['err']=__('Unable to unpublish the FAQ. Try editing it.'); break; case 'delete': $category = $faq->getCategory(); if($faq->delete()) { - $msg='FAQ deleted successfully'; + $msg=__('FAQ deleted successfully'); $faq=null; } else { - $errors['err']='Unable to delete FAQ. Try again'; + $errors['err']=__('Unable to delete FAQ. Try again'); } break; default: - $errors['err']='Invalid action'; + $errors['err']=__('Invalid action'); } } break; default: - $errors['err']='Unknown action'; + $errors['err']=__('Unknown action'); } endif; diff --git a/scp/filters.php b/scp/filters.php index dacca25c..dece9f0f 100644 --- a/scp/filters.php +++ b/scp/filters.php @@ -16,9 +16,10 @@ require('admin.inc.php'); include_once(INCLUDE_DIR.'class.filter.php'); require_once(INCLUDE_DIR.'class.canned.php'); + $filter=null; if($_REQUEST['id'] && !($filter=Filter::lookup($_REQUEST['id']))) - $errors['err']='Unknown or invalid filter.'; + $errors['err']=__('Unknown or invalid filter.'); /* NOTE: Banlist has its own interface*/ if($filter && $filter->isSystemBanlist()) @@ -28,24 +29,24 @@ switch(strtolower($_POST['do'])){ case 'update': if(!$filter){ - $errors['err']='Unknown or invalid filter.'; + $errors['err']=__('Unknown or invalid filter.'); }elseif($filter->update($_POST,$errors)){ - $msg='Filter updated successfully'; + $msg=__('Filter updated successfully'); }elseif(!$errors['err']){ - $errors['err']='Error updating filter. Try again!'; + $errors['err']=__('Error updating filter. Try again!'); } break; case 'add': if((Filter::create($_POST,$errors))){ - $msg='Filter added successfully'; + $msg=__('Filter added successfully'); $_REQUEST['a']=null; }elseif(!$errors['err']){ - $errors['err']='Unable to add filter. Correct error(s) below and try again.'; + $errors['err']=__('Unable to add filter. 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 filter to process.'; + $errors['err'] = __('You must select at least one filter to process.'); } else { $count=count($_POST['ids']); switch(strtolower($_POST['a'])) { @@ -54,11 +55,11 @@ .' WHERE id IN ('.implode(',', db_input($_POST['ids'])).')'; if(db_query($sql) && ($num=db_affected_rows())) { if($num==$count) - $msg = 'Selected filters enabled'; + $msg = __('Selected filters enabled'); else - $warn = "$num of $count selected filters enabled"; + $warn = sprintf(__('%1$d of %2$d selected filters enabled'), $num, $count); } else { - $errors['err'] = 'Unable to enable selected filters'; + $errors['err'] = __('Unable to enable selected filters'); } break; case 'disable': @@ -66,11 +67,11 @@ .' WHERE id IN ('.implode(',', db_input($_POST['ids'])).')'; if(db_query($sql) && ($num=db_affected_rows())) { if($num==$count) - $msg = 'Selected filters disabled'; + $msg = __('Selected filters disabled'); else - $warn = "$num of $count selected filters disabled"; + $warn = sprintf(__('%1$d of %2$d selected filters disabled'), $num, $count); } else { - $errors['err'] = 'Unable to disable selected filters'; + $errors['err'] = __('Unable to disable selected filters'); } break; case 'delete': @@ -81,19 +82,19 @@ } if($i && $i==$count) - $msg = 'Selected filters deleted successfully'; + $msg = __('Selected filters deleted successfully'); elseif($i>0) - $warn = "$i of $count selected filters deleted"; + $warn = sprintf(__('%1$d of %2$d selected filters deleted'), $i, $count); elseif(!$errors['err']) - $errors['err'] = 'Unable to delete selected filters'; + $errors['err'] = __('Unable to delete selected filters'); break; default: - $errors['err']='Unknown action - get technical help'; + $errors['err']=__('Unknown action - get technical help'); } } break; default: - $errors['err']='Unknown commande/action'; + $errors['err']=__('Unknown command/action'); break; } } diff --git a/scp/groups.php b/scp/groups.php index 4fb4a716..04a3dd19 100644 --- a/scp/groups.php +++ b/scp/groups.php @@ -14,34 +14,35 @@ vim: expandtab sw=4 ts=4 sts=4: **********************************************************************/ require('admin.inc.php'); + $group=null; if($_REQUEST['id'] && !($group=Group::lookup($_REQUEST['id']))) - $errors['err']='Unknown or invalid group ID.'; + $errors['err']=__('Unknown or invalid group ID.'); if($_POST){ switch(strtolower($_POST['do'])){ case 'update': if(!$group){ - $errors['err']='Unknown or invalid group.'; + $errors['err']=__('Unknown or invalid group.'); }elseif($group->update($_POST,$errors)){ - $msg='Group updated successfully'; + $msg=__('Group updated successfully'); }elseif(!$errors['err']){ - $errors['err']='Unable to update group. Correct any error(s) below and try again!'; + $errors['err']=__('Unable to update group. Correct any error(s) below and try again!'); } break; case 'create': if(($id=Group::create($_POST,$errors))){ - $msg=Format::htmlchars($_POST['name']).' added successfully'; + $msg=sprintf(__('%s added successfully'),Format::htmlchars($_POST['name'])); $_REQUEST['a']=null; }elseif(!$errors['err']){ - $errors['err']='Unable to add group. Correct error(s) below and try again.'; + $errors['err']=__('Unable to add group. 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 group.'; + $errors['err'] = __('You must select at least one group.'); } elseif(in_array($thisstaff->getGroupId(), $_POST['ids'])) { - $errors['err'] = "As an admin, you can't disable/delete a group you belong to - you might lockout all admins!"; + $errors['err'] = __("As an admin, you can't disable/delete a group you belong to - you might lockout all admins!"); } else { $count=count($_POST['ids']); switch(strtolower($_POST['a'])) { @@ -51,11 +52,11 @@ if(db_query($sql) && ($num=db_affected_rows())){ if($num==$count) - $msg = 'Selected groups activated'; + $msg = __('Selected groups activated'); else - $warn = "$num of $count selected groups activated"; + $warn = sprintf(__('%1$d of %2$d selected groups activated'), $num, $count); } else { - $errors['err'] = 'Unable to activate selected groups'; + $errors['err'] = __('Unable to activate selected groups'); } break; case 'disable': @@ -63,11 +64,11 @@ .' WHERE group_id IN ('.implode(',', db_input($_POST['ids'])).')'; if(db_query($sql) && ($num=db_affected_rows())) { if($num==$count) - $msg = 'Selected groups disabled'; + $msg = __('Selected groups disabled'); else - $warn = "$num of $count selected groups disabled"; + $warn = sprintf(__('%1$d of %2$d selected groups disabled'), $num, $count); } else { - $errors['err'] = 'Unable to disable selected groups'; + $errors['err'] = __('Unable to disable selected groups'); } break; case 'delete': @@ -77,19 +78,19 @@ } if($i && $i==$count) - $msg = 'Selected groups deleted successfully'; + $msg = __('Selected groups deleted successfully'); elseif($i>0) - $warn = "$i of $count selected groups deleted"; + $warn = sprintf(__('%1$d of %2$d selected groups deleted'), $i, $count); elseif(!$errors['err']) - $errors['err'] = 'Unable to delete selected groups'; + $errors['err'] = __('Unable to delete selected groups'); break; default: - $errors['err'] = 'Unknown action. Get technical help!'; + $errors['err'] = __('Unknown action. Get technical help!'); } } break; default: - $errors['err']='Unknown action'; + $errors['err']=__('Unknown action'); break; } } diff --git a/scp/helptopics.php b/scp/helptopics.php index 7cb15074..7567da5d 100644 --- a/scp/helptopics.php +++ b/scp/helptopics.php @@ -18,30 +18,30 @@ $topic=null; if($_REQUEST['id'] && !($topic=Topic::lookup($_REQUEST['id']))) - $errors['err']='Unknown or invalid help topic ID.'; + $errors['err']=__('Unknown or invalid help topic ID.'); if($_POST){ switch(strtolower($_POST['do'])){ case 'update': if(!$topic){ - $errors['err']='Unknown or invalid help topic.'; + $errors['err']=__('Unknown or invalid help topic.'); }elseif($topic->update($_POST,$errors)){ - $msg='Help topic updated successfully'; + $msg=__('Help topic updated successfully'); }elseif(!$errors['err']){ - $errors['err']='Error updating help topic. Try again!'; + $errors['err']=__('Error updating help topic. Try again!'); } break; case 'create': if(($id=Topic::create($_POST,$errors))){ - $msg='Help topic added successfully'; + $msg=__('Help topic added successfully'); $_REQUEST['a']=null; }elseif(!$errors['err']){ - $errors['err']='Unable to add help topic. Correct error(s) below and try again.'; + $errors['err']=__('Unable to add help topic. 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 help topic'; + $errors['err'] = __('You must select at least one help topic'); } else { $count=count($_POST['ids']); @@ -52,11 +52,11 @@ if(db_query($sql) && ($num=db_affected_rows())) { if($num==$count) - $msg = 'Selected help topics enabled'; + $msg = __('Selected help topics enabled'); else - $warn = "$num of $count selected help topics enabled"; + $warn = sprintf(__('%1$d of %2$d selected help topics enabled'), $num, $count); } else { - $errors['err'] = 'Unable to enable selected help topics.'; + $errors['err'] = __('Unable to enable selected help topics.'); } break; case 'disable': @@ -64,11 +64,11 @@ .' WHERE topic_id IN ('.implode(',', db_input($_POST['ids'])).')'; if(db_query($sql) && ($num=db_affected_rows())) { if($num==$count) - $msg = 'Selected help topics disabled'; + $msg = __('Selected help topics disabled'); else - $warn = "$num of $count selected help topics disabled"; + $warn = sprintf(__('%1$d of %2$d selected help topics disabled'), $num, $count); } else { - $errors['err'] ='Unable to disable selected help topic(s)'; + $errors['err'] =__('Unable to disable selected help topic(s)'); } break; case 'delete': @@ -79,20 +79,20 @@ } if($i && $i==$count) - $msg = 'Selected help topics deleted successfully'; + $msg = __('Selected help topics deleted successfully'); elseif($i>0) - $warn = "$i of $count selected help topics deleted"; + $warn = sprintf(__('%1$d of %2$d selected help topics deleted'), $i, $count); elseif(!$errors['err']) - $errors['err'] = 'Unable to delete selected help topics'; + $errors['err'] = __('Unable to delete selected help topics'); break; default: - $errors['err']='Unknown action - get technical help.'; + $errors['err']=__('Unknown action - get technical help.'); } } break; default: - $errors['err']='Unknown command/action'; + $errors['err']=__('Unknown command/action'); break; } } diff --git a/scp/kb.php b/scp/kb.php index 4f2bc335..ad757b42 100644 --- a/scp/kb.php +++ b/scp/kb.php @@ -15,9 +15,10 @@ **********************************************************************/ require('staff.inc.php'); require_once(INCLUDE_DIR.'class.faq.php'); + $category=null; if($_REQUEST['cid'] && !($category=Category::lookup($_REQUEST['cid']))) - $errors['err']='Unknown or invalid FAQ category'; + $errors['err']=__('Unknown or invalid FAQ category'); $inc='faq-categories.inc.php'; //KB landing page. if($category && $_REQUEST['a']!='search') { diff --git a/scp/login.php b/scp/login.php index fcefaafd..03e8d632 100644 --- a/scp/login.php +++ b/scp/login.php @@ -21,7 +21,7 @@ $dest = $_SESSION['_staff']['auth']['dest']; $msg = $_SESSION['_staff']['auth']['msg']; -$msg = $msg?$msg:'Authentication Required'; +$msg = $msg?$msg:__('Authentication Required'); if($_POST) { //$_SESSION['_staff']=array(); #Uncomment to disable login strikes. if(($user=Staff::login($_POST['username'], $_POST['passwd'], $errors))){ @@ -31,7 +31,7 @@ exit; } - $msg = $errors['err']?$errors['err']:'Invalid login'; + $msg = $errors['err']?$errors['err']:__('Invalid login'); } define("OSTSCPINC",TRUE); //Make includes happy! include_once(INCLUDE_DIR.'staff/login.tpl.php'); diff --git a/scp/logout.php b/scp/logout.php index 7076dcec..e012bb0b 100644 --- a/scp/logout.php +++ b/scp/logout.php @@ -1,30 +1,31 @@ - - 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('staff.inc.php'); -//Check token: Make sure the user actually clicked on the link to logout. -if(!$_GET['auth'] || !$ost->validateLinkToken($_GET['auth'])) - @header('Location: index.php'); - -$ost->logDebug('Staff logout', - sprintf("%s logged out [%s]", - $thisstaff->getUserName(), $_SERVER['REMOTE_ADDR'])); //Debug. -$_SESSION['_staff']=array(); -session_unset(); -session_destroy(); -@header('Location: login.php'); -require('login.php'); -?> + + 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('staff.inc.php'); + +//Check token: Make sure the user actually clicked on the link to logout. +if(!$_GET['auth'] || !$ost->validateLinkToken($_GET['auth'])) + @header('Location: index.php'); + +$ost->logDebug(__('Staff logout'), + sprintf(__('%1$s logged out [%2$s]'), + $thisstaff->getUserName(), $_SERVER['REMOTE_ADDR'])); //Debug. +$_SESSION['_staff']=array(); +session_unset(); +session_destroy(); +@header('Location: login.php'); +require('login.php'); +?> diff --git a/scp/logs.php b/scp/logs.php index 09c83154..5644e051 100644 --- a/scp/logs.php +++ b/scp/logs.php @@ -19,7 +19,7 @@ switch(strtolower($_POST['do'])){ case 'mass_process': if(!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) { - $errors['err'] = 'You must select at least one log to delete'; + $errors['err'] = __('You must select at least one log to delete'); } else { $count=count($_POST['ids']); if($_POST['a'] && !strcasecmp($_POST['a'], 'delete')) { @@ -28,18 +28,18 @@ .' WHERE log_id IN ('.implode(',', db_input($_POST['ids'])).')'; if(db_query($sql) && ($num=db_affected_rows())){ if($num==$count) - $msg='Selected logs deleted successfully'; + $msg=__('Selected logs deleted successfully'); else - $warn="$num of $count selected logs deleted"; + $warn=sprintf(__('%1$d of %2$d selected logs deleted'), $num, $count); } elseif(!$errors['err']) - $errors['err']='Unable to delete selected logs'; + $errors['err']=__('Unable to delete selected logs'); } else { - $errors['err']='Unknown action - get technical help'; + $errors['err']=__('Unknown action - get technical help'); } } break; default: - $errors['err']='Unknown command/action'; + $errors['err']=__('Unknown command/action'); break; } } diff --git a/scp/profile.php b/scp/profile.php index 31ffecae..bb24d52f 100644 --- a/scp/profile.php +++ b/scp/profile.php @@ -15,29 +15,30 @@ **********************************************************************/ require_once('staff.inc.php'); + $msg=''; $staff=Staff::lookup($thisstaff->getId()); if($_POST && $_POST['id']!=$thisstaff->getId()) { //Check dummy ID used on the form. - $errors['err']='Internal Error. Action Denied'; + $errors['err']=__('Internal Error. Action Denied'); } elseif(!$errors && $_POST) { //Handle post if(!$staff) - $errors['err']='Unknown or invalid staff'; + $errors['err']=__('Unknown or invalid staff'); elseif($staff->updateProfile($_POST,$errors)){ - $msg='Profile updated successfully'; + $msg=__('Profile updated successfully'); $thisstaff->reload(); $staff->reload(); $_SESSION['TZ_OFFSET']=$thisstaff->getTZoffset(); $_SESSION['TZ_DST']=$thisstaff->observeDaylight(); }elseif(!$errors['err']) - $errors['err']='Profile update error. Try correcting the errors below and try again!'; + $errors['err']=__('Profile update error. Try correcting the errors below and try again!'); } //Forced password Change. if($thisstaff->forcePasswdChange() && !$errors['err']) - $errors['err']=sprintf('Hi %s - You must change your password to continue!',$thisstaff->getFirstName()); + $errors['err']=sprintf(__('Hi %s - You must change your password to continue!'),$thisstaff->getFirstName()); elseif($thisstaff->onVacation() && !$warn) - $warn=sprintf('Welcome back %s! You are listed as \'on vacation\' Please let your manager know that you are back.',$thisstaff->getFirstName()); + $warn=sprintf(__("Welcome back %s! You are listed as 'on vacation' Please let your manager know that you are back."),$thisstaff->getFirstName()); $inc='profile.inc.php'; $nav->setTabActive('dashboard'); diff --git a/scp/settings.php b/scp/settings.php index 2b30ced1..ed404dc9 100644 --- a/scp/settings.php +++ b/scp/settings.php @@ -13,21 +13,22 @@ vim: expandtab sw=4 ts=4 sts=4: **********************************************************************/ + require('admin.inc.php'); $errors=array(); $settingOptions=array( - 'system' => 'System Settings', - 'tickets' => 'Ticket Settings and Options', - 'emails' => 'Email Settings', - 'kb' => 'Knowledgebase Settings', - 'autoresp' => 'Autoresponder Settings', - 'alerts' => 'Alerts and Notices Settings'); + 'system' => __('System Settings'), + 'tickets' => __('Ticket Settings and Options'), + 'emails' => __('Email Settings'), + 'kb' => __('Knowledgebase Settings'), + 'autoresp' => __('Autoresponder Settings'), + 'alerts' => __('Alerts and Notices Settings')); //Handle a POST. if($_POST && !$errors) { if($cfg && $cfg->updateSettings($_POST,$errors)) { $msg=Format::htmlchars($settingOptions[$_POST['t']]).' Updated Successfully'; } elseif(!$errors['err']) { - $errors['err']='Unable to update settings - correct errors below and try again'; + $errors['err']=__('Unable to update settings - correct errors below and try again'); } } diff --git a/scp/slas.php b/scp/slas.php index 072b2779..93e057a1 100644 --- a/scp/slas.php +++ b/scp/slas.php @@ -18,30 +18,30 @@ $sla=null; if($_REQUEST['id'] && !($sla=SLA::lookup($_REQUEST['id']))) - $errors['err']='Unknown or invalid API key ID.'; + $errors['err']=__('Unknown or invalid API key ID.'); if($_POST){ switch(strtolower($_POST['do'])){ case 'update': if(!$sla){ - $errors['err']='Unknown or invalid SLA plan.'; + $errors['err']=__('Unknown or invalid SLA plan.'); }elseif($sla->update($_POST,$errors)){ - $msg='SLA plan updated successfully'; + $msg=__('SLA plan updated successfully'); }elseif(!$errors['err']){ - $errors['err']='Error updating SLA plan. Try again!'; + $errors['err']=__('Error updating SLA plan. Try again!'); } break; case 'add': if(($id=SLA::create($_POST,$errors))){ - $msg='SLA plan added successfully'; + $msg=__('SLA plan added successfully'); $_REQUEST['a']=null; }elseif(!$errors['err']){ - $errors['err']='Unable to add SLA plan. Correct error(s) below and try again.'; + $errors['err']=__('Unable to add SLA plan. 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 plan.'; + $errors['err'] = __('You must select at least one plan.'); } else { $count=count($_POST['ids']); switch(strtolower($_POST['a'])) { @@ -51,11 +51,11 @@ if(db_query($sql) && ($num=db_affected_rows())) { if($num==$count) - $msg = 'Selected SLA plans enabled'; + $msg = __('Selected SLA plans enabled'); else - $warn = "$num of $count selected SLA plans enabled"; + $warn = sprintf(__('%1$d of %2$d selected SLA plans enabled'), $num, $count); } else { - $errors['err'] = 'Unable to enable selected SLA plans.'; + $errors['err'] = __('Unable to enable selected SLA plans.'); } break; case 'disable': @@ -63,11 +63,11 @@ .' WHERE id IN ('.implode(',', db_input($_POST['ids'])).')'; if(db_query($sql) && ($num=db_affected_rows())) { if($num==$count) - $msg = 'Selected SLA plans disabled'; + $msg = __('Selected SLA plans disabled'); else - $warn = "$num of $count selected SLA plans disabled"; + $warn = sprintf(__('%1$d of %2$d selected SLA plans disabled'), $num, $count); } else { - $errors['err'] = 'Unable to disable selected SLA plans'; + $errors['err'] = __('Unable to disable selected SLA plans'); } break; case 'delete': @@ -78,19 +78,19 @@ } if($i && $i==$count) - $msg = 'Selected SLA plans deleted successfully'; + $msg = __('Selected SLA plans deleted successfully'); elseif($i>0) - $warn = "$i of $count selected SLA plans deleted"; + $warn = sprintf(__('%1$d of %2$d selected SLA plans deleted'), $i, $count); elseif(!$errors['err']) - $errors['err'] = 'Unable to delete selected SLA plans'; + $errors['err'] = __('Unable to delete selected SLA plans'); break; default: - $errors['err']='Unknown action - get technical help.'; + $errors['err']=__('Unknown action - get technical help.'); } } break; default: - $errors['err']='Unknown action/command'; + $errors['err']=__('Unknown action/command'); break; } } diff --git a/scp/staff.inc.php b/scp/staff.inc.php index 577fdd12..a55fb46e 100644 --- a/scp/staff.inc.php +++ b/scp/staff.inc.php @@ -33,7 +33,6 @@ /* Tables used by staff only */ define('KB_PREMADE_TABLE',TABLE_PREFIX.'kb_premade'); - /* include what is needed on staff control panel */ require_once(INCLUDE_DIR.'class.staff.php'); @@ -59,7 +58,7 @@ function staffLoginPage($msg) { $thisstaff = new StaffSession($_SESSION['_staff']['userID']); //Set staff object. //1) is the user Logged in for real && is staff. if(!$thisstaff || !is_object($thisstaff) || !$thisstaff->getId() || !$thisstaff->isValid()){ - $msg=(!$thisstaff || !$thisstaff->isValid())?'Authentication Required':'Session timed out due to inactivity'; + $msg=(!$thisstaff || !$thisstaff->isValid())?__('Authentication Required'):__('Session timed out due to inactivity'); staffLoginPage($msg); exit; } @@ -67,13 +66,13 @@ function staffLoginPage($msg) { if(!$thisstaff->isAdmin()) { //Check for disabled staff or group! if(!$thisstaff->isactive() || !$thisstaff->isGroupActive()) { - staffLoginPage('Access Denied. Contact Admin'); + staffLoginPage(__('Access Denied. Contact Admin')); exit; } //Staff are not allowed to login in offline mode!! if(!$ost->isSystemOnline() || $ost->isUpgradePending()) { - staffLoginPage('System Offline'); + staffLoginPage(__('System Offline')); exit; } } @@ -84,7 +83,7 @@ function staffLoginPage($msg) { /******* CSRF Protectin *************/ // Enforce CSRF protection for POSTS if ($_POST && !$ost->checkCSRFToken()) { - Http::response(400, 'Valid CSRF Token Required'); + Http::response(400, __('Valid CSRF Token Required')); exit; } @@ -106,12 +105,30 @@ function staffLoginPage($msg) { $exempt = in_array(basename($_SERVER['SCRIPT_NAME']), array('logout.php', 'ajax.php', 'logs.php', 'upgrade.php')); if($ost->isUpgradePending() && !$exempt) { - $errors['err']=$sysnotice='System upgrade is pending Upgrade Now'; + $errors['err']=$sysnotice=__('System upgrade is pending').' '.__('Upgrade Now').''; require('upgrade.php'); exit; } elseif($cfg->isHelpDeskOffline()) { - $sysnotice='System is set to offline mode - Client interface is disabled and ONLY admins can access staff control panel.'; - $sysnotice.=' Enable.'; + $sysnotice=''.__('System is set to offline mode').' - '.__('Client interface is disabled and ONLY admins can access staff control panel.'); + $sysnotice.=' '.__('Enable').'.'; +} + +if($use_php_gettext==true&&!function_exists('mb_detect_encoding')) +{ + $sysnotice='mbstring extension is required to use php_gettext'; +} +if($use_php_gettext==true&&function_exists('mb_detect_encoding')) +{ + $f = fopen(INCLUDE_DIR.'locale/'.$language.'/LC_MESSAGES/messages.mo', 'r'); + $meta = stream_get_meta_data($f); + if($meta['mode']==NULL) + { + $sysnotice='The translation file "include/locale/'.$language.'/LC_MESSAGES/messages.mo" isn\'t readable, check permissions.'; + } + else + { + fclose($f); + } } $nav = new StaffNav($thisstaff); @@ -119,11 +136,11 @@ function staffLoginPage($msg) { if($thisstaff->forcePasswdChange() && !$exempt) { # XXX: Call staffLoginPage() for AJAX and API requests _not_ to honor # the request - $sysnotice = 'Password change required to continue'; + $sysnotice = __('Password change required to continue'); require('profile.php'); //profile.php must request this file as require_once to avoid problems. exit; } $ost->setWarning($sysnotice); -$ost->setPageTitle('osTicket :: Staff Control Panel'); +$ost->setPageTitle(__('osTicket :: Staff Control Panel')); ?> diff --git a/scp/staff.php b/scp/staff.php index b2d78f3c..dc2404da 100644 --- a/scp/staff.php +++ b/scp/staff.php @@ -14,34 +14,35 @@ vim: expandtab sw=4 ts=4 sts=4: **********************************************************************/ require('admin.inc.php'); + $staff=null; if($_REQUEST['id'] && !($staff=Staff::lookup($_REQUEST['id']))) - $errors['err']='Unknown or invalid staff ID.'; + $errors['err']=__('Unknown or invalid staff ID.'); if($_POST){ switch(strtolower($_POST['do'])){ case 'update': if(!$staff){ - $errors['err']='Unknown or invalid staff.'; + $errors['err']=__('Unknown or invalid staff.'); }elseif($staff->update($_POST,$errors)){ - $msg='Staff updated successfully'; + $msg=__('Staff updated successfully'); }elseif(!$errors['err']){ - $errors['err']='Unable to update staff. Correct any error(s) below and try again!'; + $errors['err']=__('Unable to update staff. Correct any error(s) below and try again!'); } break; case 'create': if(($id=Staff::create($_POST,$errors))){ - $msg=Format::htmlchars($_POST['name']).' added successfully'; + $msg=sprintf(__('%s added successfully'),Format::htmlchars($_POST['name'])); $_REQUEST['a']=null; }elseif(!$errors['err']){ - $errors['err']='Unable to add staff. Correct any error(s) below and try again.'; + $errors['err']=__('Unable to add staff. Correct any 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 staff member.'; + $errors['err'] = __('You must select at least one staff member.'); } elseif(in_array($thisstaff->getId(),$_POST['ids'])) { - $errors['err'] = 'You can not disable/delete yourself - you could be the only admin!'; + $errors['err'] = __('You can not disable/delete yourself - you could be the only admin!'); } else { $count=count($_POST['ids']); switch(strtolower($_POST['a'])) { @@ -51,11 +52,11 @@ if(db_query($sql) && ($num=db_affected_rows())) { if($num==$count) - $msg = 'Selected staff activated'; + $msg = __('Selected staff activated'); else - $warn = "$num of $count selected staff activated"; + $warn = sprintf(__('%1$d of %2$d selected staff activated'), $num, $count); } else { - $errors['err'] = 'Unable to activate selected staff'; + $errors['err'] = __('Unable to activate selected staff'); } break; case 'disable': @@ -64,11 +65,11 @@ if(db_query($sql) && ($num=db_affected_rows())) { if($num==$count) - $msg = 'Selected staff disabled'; + $msg = __('Selected staff disabled'); else - $warn = "$num of $count selected staff disabled"; + $warn = sprintf(__('%1$d of %2$d selected staff disabled'), $num, $count); } else { - $errors['err'] = 'Unable to disable selected staff'; + $errors['err'] = __('Unable to disable selected staff'); } break; case 'delete': @@ -78,20 +79,20 @@ } if($i && $i==$count) - $msg = 'Selected staff deleted successfully'; + $msg = __('Selected staff deleted successfully'); elseif($i>0) - $warn = "$i of $count selected staff deleted"; + $warn = sprintf(__('%1$d of %2$d selected staff deleted'), $i, $count); elseif(!$errors['err']) - $errors['err'] = 'Unable to delete selected staff.'; + $errors['err'] = __('Unable to delete selected staff.'); break; default: - $errors['err'] = 'Unknown action. Get technical help!'; + $errors['err'] = __('Unknown action. Get technical help!'); } } break; default: - $errors['err']='Unknown action/command'; + $errors['err']=__('Unknown action/command'); break; } } diff --git a/scp/teams.php b/scp/teams.php index ce877bea..099f0f1d 100644 --- a/scp/teams.php +++ b/scp/teams.php @@ -14,32 +14,33 @@ vim: expandtab sw=4 ts=4 sts=4: **********************************************************************/ require('admin.inc.php'); + $team=null; if($_REQUEST['id'] && !($team=Team::lookup($_REQUEST['id']))) - $errors['err']='Unknown or invalid team ID.'; + $errors['err']=__('Unknown or invalid team ID.'); if($_POST){ switch(strtolower($_POST['do'])){ case 'update': if(!$team){ - $errors['err']='Unknown or invalid team.'; + $errors['err']=__('Unknown or invalid team.'); }elseif($team->update($_POST,$errors)){ - $msg='Team updated successfully'; + $msg=__('Team updated successfully'); }elseif(!$errors['err']){ - $errors['err']='Unable to update team. Correct any error(s) below and try again!'; + $errors['err']=__('Unable to update team. Correct any error(s) below and try again!'); } break; case 'create': if(($id=Team::create($_POST,$errors))){ - $msg=Format::htmlchars($_POST['team']).' added successfully'; + $msg=sprintf(__('%s added successfully'),Format::htmlchars($_POST['team'])); $_REQUEST['a']=null; }elseif(!$errors['err']){ - $errors['err']='Unable to add team. Correct any error(s) below and try again.'; + $errors['err']=__('Unable to add team. Correct any 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 team.'; + $errors['err']=__('You must select at least one team.'); } else { $count=count($_POST['ids']); switch(strtolower($_POST['a'])) { @@ -49,11 +50,11 @@ if(db_query($sql) && ($num=db_affected_rows())) { if($num==$count) - $msg = 'Selected teams activated'; + $msg = __('Selected teams activated'); else - $warn = "$num of $count selected teams activated"; + $warn = sprintf(__('%1$d of %2$d selected teams activated'), $num, $count); } else { - $errors['err'] = 'Unable to activate selected teams'; + $errors['err'] = __('Unable to activate selected teams'); } break; case 'disable': @@ -62,11 +63,11 @@ if(db_query($sql) && ($num=db_affected_rows())) { if($num==$count) - $msg = 'Selected teams disabled'; + $msg = __('Selected teams disabled'); else - $warn = "$num of $count selected teams disabled"; + $warn = sprintf(__('%1$d of %2$d selected teams disabled'), $num, $count); } else { - $errors['err'] = 'Unable to disable selected teams'; + $errors['err'] = __('Unable to disable selected teams'); } break; case 'delete': @@ -75,19 +76,19 @@ $i++; } if($i && $i==$count) - $msg = 'Selected teams deleted successfully'; + $msg = __('Selected teams deleted successfully'); elseif($i>0) - $warn = "$i of $count selected teams deleted"; + $warn = sprintf(__('%1$d of %2$d selected teams deleted'), $i, $count); elseif(!$errors['err']) - $errors['err'] = 'Unable to delete selected teams'; + $errors['err'] = __('Unable to delete selected teams'); break; default: - $errors['err'] = 'Unknown action. Get technical help!'; + $errors['err'] = __('Unknown action. Get technical help!'); } } break; default: - $errors['err']='Unknown action/command'; + $errors['err']=__('Unknown action/command'); break; } } diff --git a/scp/templates.php b/scp/templates.php index a27d69b0..14c513d8 100644 --- a/scp/templates.php +++ b/scp/templates.php @@ -15,42 +15,43 @@ **********************************************************************/ require('admin.inc.php'); include_once(INCLUDE_DIR.'class.template.php'); + $template=null; if($_REQUEST['id'] && !($template=Template::lookup($_REQUEST['id']))) - $errors['err']='Unknown or invalid template ID.'; + $errors['err']=__('Unknown or invalid template ID.'); if($_POST){ switch(strtolower($_POST['do'])){ case 'updatetpl': if(!$template){ - $errors['err']='Unknown or invalid template'; + $errors['err']=__('Unknown or invalid template'); }elseif($template->updateMsgTemplate($_POST,$errors)){ $template->reload(); - $msg='Message template updated successfully'; + $msg=__('Message template updated successfully'); }elseif(!$errors['err']){ - $errors['err']='Error updating message template. Try again!'; + $errors['err']=__('Error updating message template. Try again!'); } break; case 'update': if(!$template){ - $errors['err']='Unknown or invalid template'; + $errors['err']=__('Unknown or invalid template'); }elseif($template->update($_POST,$errors)){ - $msg='Template updated successfully'; + $msg=__('Template updated successfully'); }elseif(!$errors['err']){ - $errors['err']='Error updating template. Try again!'; + $errors['err']=__('Error updating template. Try again!'); } break; case 'add': if((Template::create($_POST,$errors))){ - $msg='Template added successfully'; + $msg=__('Template added successfully'); $_REQUEST['a']=null; }elseif(!$errors['err']){ - $errors['err']='Unable to add template. Correct error(s) below and try again.'; + $errors['err']=__('Unable to add template. 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 template to process.'; + $errors['err']=__('You must select at least one template to process.'); } else { $count=count($_POST['ids']); switch(strtolower($_POST['a'])) { @@ -59,11 +60,11 @@ .' WHERE tpl_id IN ('.implode(',', db_input($_POST['ids'])).')'; if(db_query($sql) && ($num=db_affected_rows())){ if($num==$count) - $msg = 'Selected templates enabled'; + $msg = __('Selected templates enabled'); else - $warn = "$num of $count selected templates enabled"; + $warn = sprintf(__('%1$d of %2$d selected templates enabled'), $num, $count); } else { - $errors['err'] = 'Unable to enable selected templates'; + $errors['err'] = __('Unable to enable selected templates'); } break; case 'disable': @@ -73,11 +74,11 @@ $i++; } if($i && $i==$count) - $msg = 'Selected templates disabled'; + $msg = __('Selected templates disabled'); elseif($i) - $warn = "$i of $count selected templates disabled (in-use templates can't be disabled)"; + $warn = sprintf(__('%1$d of %2$d selected templates disabled (in-use templates can\'t be disabled)'), $i, $count); else - $errors['err'] = "Unable to disable selected templates (in-use or default template can't be disabled)"; + $errors['err'] = __("Unable to disable selected templates (in-use or default template can't be disabled)"); break; case 'delete': $i=0; @@ -87,19 +88,19 @@ } if($i && $i==$count) - $msg = 'Selected templates deleted successfully'; + $msg = __('Selected templates deleted successfully'); elseif($i>0) - $warn = "$i of $count selected templates deleted"; + $warn = sprintf(__('%1$d of %2$d selected templates deleted'), $i, $count); elseif(!$errors['err']) - $errors['err'] = 'Unable to delete selected templates'; + $errors['err'] = __('Unable to delete selected templates'); break; default: - $errors['err']='Unknown template action'; + $errors['err']=__('Unknown template action'); } } break; default: - $errors['err']='Unknown action'; + $errors['err']=__('Unknown action'); break; } } diff --git a/scp/tickets.php b/scp/tickets.php index 0a9ba30a..ddaa047e 100644 --- a/scp/tickets.php +++ b/scp/tickets.php @@ -20,15 +20,14 @@ require_once(INCLUDE_DIR.'class.filter.php'); require_once(INCLUDE_DIR.'class.canned.php'); - $page=''; $ticket=null; //clean start. //LOCKDOWN...See if the id provided is actually valid and if the user has access. if($_REQUEST['id']) { if(!($ticket=Ticket::lookup($_REQUEST['id']))) - $errors['err']='Unknown or invalid ticket ID'; + $errors['err']=__('Unknown or invalid ticket ID'); elseif(!$ticket->checkStaffAccess($thisstaff)) { - $errors['err']='Access denied. Contact admin if you believe this is in error'; + $errors['err']=__('Access denied. Contact admin if you believe this is in error'); $ticket=null; //Clear ticket obj. } } @@ -43,18 +42,18 @@ switch(strtolower($_POST['a'])): case 'reply': if(!$thisstaff->canPostReply()) - $errors['err'] = 'Action denied. Contact admin for access'; + $errors['err'] = __('Action denied. Contact admin for access'); else { if(!$_POST['response']) - $errors['response']='Response required'; + $errors['response']=__('Response required'); //Use locks to avoid double replies if($lock && $lock->getStaffId()!=$thisstaff->getId()) - $errors['err']='Action Denied. Ticket is locked by someone else!'; + $errors['err']=__('Action Denied. Ticket is locked by someone else!'); //Make sure the email is not banned if(!$errors['err'] && TicketFilter::isBanned($ticket->getEmail())) - $errors['err']='Email is in banlist. Must be removed to reply.'; + $errors['err']=__('Email is in banlist. Must be removed to reply.'); } $wasOpen =($ticket->isOpen()); @@ -65,87 +64,87 @@ $vars['files'] = AttachmentFile::format($_FILES['attachments']); if(!$errors && ($response=$ticket->postReply($vars, $errors, isset($_POST['emailreply'])))) { - $msg='Reply posted successfully'; + $msg=__('Reply posted successfully'); $ticket->reload(); if($ticket->isClosed() && $wasOpen) $ticket=null; } elseif(!$errors['err']) { - $errors['err']='Unable to post the reply. Correct the errors below and try again!'; + $errors['err']=__('Unable to post the reply. Correct the errors below and try again!'); } break; case 'transfer': /** Transfer ticket **/ //Check permission if(!$thisstaff->canTransferTickets()) - $errors['err']=$errors['transfer'] = 'Action Denied. You are not allowed to transfer tickets.'; + $errors['err']=$errors['transfer'] = __('Action Denied. You are not allowed to transfer tickets.'); else { //Check target dept. if(!$_POST['deptId']) - $errors['deptId'] = 'Select department'; + $errors['deptId'] = __('Select department'); elseif($_POST['deptId']==$ticket->getDeptId()) - $errors['deptId'] = 'Ticket already in the department'; + $errors['deptId'] = __('Ticket already in the department'); elseif(!($dept=Dept::lookup($_POST['deptId']))) - $errors['deptId'] = 'Unknown or invalid department'; + $errors['deptId'] = __('Unknown or invalid department'); //Transfer message - required. if(!$_POST['transfer_comments']) - $errors['transfer_comments'] = 'Transfer comments required'; + $errors['transfer_comments'] = __('Transfer comments required'); elseif(strlen($_POST['transfer_comments'])<5) - $errors['transfer_comments'] = 'Transfer comments too short!'; + $errors['transfer_comments'] = __('Transfer comments too short!'); //If no errors - them attempt the transfer. if(!$errors && $ticket->transfer($_POST['deptId'], $_POST['transfer_comments'])) { - $msg = 'Ticket transferred successfully to '.$ticket->getDeptName(); + $msg = sprintf(__('Ticket transferred successfully to %s'),$ticket->getDeptName()); //Check to make sure the staff still has access to the ticket if(!$ticket->checkStaffAccess($thisstaff)) $ticket=null; } elseif(!$errors['transfer']) { - $errors['err'] = 'Unable to complete the ticket transfer'; - $errors['transfer']='Correct the error(s) below and try again!'; + $errors['err'] = __('Unable to complete the ticket transfer'); + $errors['transfer']=__('Correct the error(s) below and try again!'); } } break; case 'assign': if(!$thisstaff->canAssignTickets()) - $errors['err']=$errors['assign'] = 'Action Denied. You are not allowed to assign/reassign tickets.'; + $errors['err']=$errors['assign'] = __('Action Denied. You are not allowed to assign/reassign tickets.'); else { $id = preg_replace("/[^0-9]/", "",$_POST['assignId']); $claim = (is_numeric($_POST['assignId']) && $_POST['assignId']==$thisstaff->getId()); if(!$_POST['assignId'] || !$id) - $errors['assignId'] = 'Select assignee'; + $errors['assignId'] = __('Select assignee'); elseif($_POST['assignId'][0]!='s' && $_POST['assignId'][0]!='t' && !$claim) - $errors['assignId']='Invalid assignee ID - get technical support'; + $errors['assignId']=__('Invalid assignee ID - get technical support'); elseif($ticket->isAssigned()) { if($_POST['assignId'][0]=='s' && $id==$ticket->getStaffId()) - $errors['assignId']='Ticket already assigned to the staff.'; + $errors['assignId']=__('Ticket already assigned to the staff.'); elseif($_POST['assignId'][0]=='t' && $id==$ticket->getTeamId()) - $errors['assignId']='Ticket already assigned to the team.'; + $errors['assignId']=__('Ticket already assigned to the team.'); } //Comments are not required on self-assignment (claim) if($claim && !$_POST['assign_comments']) - $_POST['assign_comments'] = 'Ticket claimed by '.$thisstaff->getName(); + $_POST['assign_comments'] = sprintf(__('Ticket claimed by %s'),$thisstaff->getName()); elseif(!$_POST['assign_comments']) - $errors['assign_comments'] = 'Assignment comments required'; + $errors['assign_comments'] = __('Assignment comments required'); elseif(strlen($_POST['assign_comments'])<5) - $errors['assign_comments'] = 'Comment too short'; + $errors['assign_comments'] = __('Comment too short'); if(!$errors && $ticket->assign($_POST['assignId'], $_POST['assign_comments'], !$claim)) { if($claim) { - $msg = 'Ticket is NOW assigned to you!'; + $msg = __('Ticket is NOW assigned to you!'); } else { - $msg='Ticket assigned successfully to '.$ticket->getAssigned(); + $msg=sprintf(__('Ticket assigned successfully to %s'), $ticket->getAssigned()); TicketLock::removeStaffLocks($thisstaff->getId(), $ticket->getId()); $ticket=null; } } elseif(!$errors['assign']) { - $errors['err'] = 'Unable to complete the ticket assignment'; - $errors['assign'] = 'Correct the error(s) below and try again!'; + $errors['err'] = __('Unable to complete the ticket assignment'); + $errors['assign'] = __('Correct the error(s) below and try again!'); } } break; @@ -153,10 +152,10 @@ //Make sure the staff can set desired state if($_POST['state']) { if($_POST['state']=='closed' && !$thisstaff->canCloseTickets()) - $errors['state'] = "You don't have permission to close tickets"; + $errors['state'] = __("You don't have permission to close tickets"); elseif(in_array($_POST['state'], array('overdue', 'notdue', 'unassigned')) && (!($dept=$ticket->getDept()) || !$dept->isManager($thisstaff))) - $errors['state'] = "You don't have permission to set the state"; + $errors['state'] = __("You don't have permission to set the state"); } $wasOpen = ($ticket->isOpen()); @@ -167,176 +166,175 @@ if(($note=$ticket->postNote($vars, $errors, $thisstaff))) { - $msg='Internal note posted successfully'; + $msg=__('Internal note posted successfully'); if($wasOpen && $ticket->isClosed()) $ticket = null; //Going back to main listing. - } else { if(!$errors['err']) - $errors['err'] = 'Unable to post internal note - missing or invalid data.'; + $errors['err'] = __('Unable to post internal note - missing or invalid data.'); - $errors['postnote'] = 'Unable to post the note. Correct the error(s) below and try again!'; + $errors['postnote'] = __('Unable to post the note. Correct the error(s) below and try again!'); } break; case 'edit': case 'update': if(!$ticket || !$thisstaff->canEditTickets()) - $errors['err']='Perm. Denied. You are not allowed to edit tickets'; + $errors['err']=__('Perm. Denied. You are not allowed to edit tickets'); elseif($ticket->update($_POST,$errors)) { - $msg='Ticket updated successfully'; + $msg=__('Ticket updated successfully'); $_REQUEST['a'] = null; //Clear edit action - going back to view. //Check to make sure the staff STILL has access post-update (e.g dept change). if(!$ticket->checkStaffAccess($thisstaff)) $ticket=null; } elseif(!$errors['err']) { - $errors['err']='Unable to update the ticket. Correct the errors below and try again!'; + $errors['err']=__('Unable to update the ticket. Correct the errors below and try again!'); } break; case 'process': switch(strtolower($_POST['do'])): case 'close': if(!$thisstaff->canCloseTickets()) { - $errors['err'] = 'Perm. Denied. You are not allowed to close tickets.'; + $errors['err'] = __('Perm. Denied. You are not allowed to close tickets.'); } elseif($ticket->isClosed()) { - $errors['err'] = 'Ticket is already closed!'; + $errors['err'] = __('Ticket is already closed!'); } elseif($ticket->close()) { - $msg='Ticket #'.$ticket->getExtId().' status set to CLOSED'; + $msg=sprintf(__('Ticket #%d status set to CLOSED'),$ticket->getExtId()); //Log internal note if($_POST['ticket_status_notes']) $note = $_POST['ticket_status_notes']; else - $note='Ticket closed (without comments)'; + $note=__('Ticket closed (without comments)'); - $ticket->logNote('Ticket Closed', $note, $thisstaff); + $ticket->logNote(__('Ticket Closed'), $note, $thisstaff); //Going back to main listing. TicketLock::removeStaffLocks($thisstaff->getId(), $ticket->getId()); $page=$ticket=null; } else { - $errors['err']='Problems closing the ticket. Try again'; + $errors['err']=__('Problems closing the ticket. Try again'); } break; case 'reopen': //if staff can close or create tickets ...then assume they can reopen. if(!$thisstaff->canCloseTickets() && !$thisstaff->canCreateTickets()) { - $errors['err']='Perm. Denied. You are not allowed to reopen tickets.'; + $errors['err']=__('Perm. Denied. You are not allowed to reopen tickets.'); } elseif($ticket->isOpen()) { - $errors['err'] = 'Ticket is already open!'; + $errors['err'] = __('Ticket is already open!'); } elseif($ticket->reopen()) { - $msg='Ticket REOPENED'; + $msg=__('Ticket REOPENED'); if($_POST['ticket_status_notes']) $note = $_POST['ticket_status_notes']; else - $note='Ticket reopened (without comments)'; + $note=__('Ticket reopened (without comments)'); - $ticket->logNote('Ticket Reopened', $note, $thisstaff); + $ticket->logNote(__('Ticket Reopened'), $note, $thisstaff); } else { - $errors['err']='Problems reopening the ticket. Try again'; + $errors['err']=__('Problems reopening the ticket. Try again'); } break; case 'release': if(!$ticket->isAssigned() || !($assigned=$ticket->getAssigned())) { - $errors['err'] = 'Ticket is not assigned!'; + $errors['err'] = __('Ticket is not assigned!'); } elseif($ticket->release()) { - $msg='Ticket released (unassigned) from '.$assigned; - $ticket->logActivity('Ticket unassigned',$msg.' by '.$thisstaff->getName()); + $msg=sprintf(__('Ticket released (unassigned) from %1$s by %2$s)'),$assigned,$thisstaff->getName()); + $ticket->logActivity(__('Ticket unassigned'),$msg); } else { - $errors['err'] = 'Problems releasing the ticket. Try again'; + $errors['err'] = __('Problems releasing the ticket. Try again'); } break; case 'claim': if(!$thisstaff->canAssignTickets()) { - $errors['err'] = 'Perm. Denied. You are not allowed to assign/claim tickets.'; + $errors['err'] = __('Perm. Denied. You are not allowed to assign/claim tickets.'); } elseif(!$ticket->isOpen()) { - $errors['err'] = 'Only open tickets can be assigned'; + $errors['err'] = __('Only open tickets can be assigned'); } elseif($ticket->isAssigned()) { - $errors['err'] = 'Ticket is already assigned to '.$ticket->getAssigned(); - } elseif($ticket->assignToStaff($thisstaff->getId(), ('Ticket claimed by '.$thisstaff->getName()), false)) { - $msg = 'Ticket is now assigned to you!'; + $errors['err'] = sprintf(__('Ticket is already assigned to %s'),$ticket->getAssigned()); + } elseif($ticket->assignToStaff($thisstaff->getId(), (sprintf(__('Ticket claimed by %s'),$thisstaff->getName())), false)) { + $msg = __('Ticket is now assigned to you!'); } else { - $errors['err'] = 'Problems assigning the ticket. Try again'; + $errors['err'] = __('Problems assigning the ticket. Try again'); } break; case 'overdue': $dept = $ticket->getDept(); if(!$dept || !$dept->isManager($thisstaff)) { - $errors['err']='Perm. Denied. You are not allowed to flag tickets overdue'; + $errors['err']=__('Perm. Denied. You are not allowed to flag tickets overdue'); } elseif($ticket->markOverdue()) { - $msg='Ticket flagged as overdue'; - $ticket->logActivity('Ticket Marked Overdue',($msg.' by '.$thisstaff->getName())); + $msg=sprintf(__('Ticket flagged as overdue by %s'),$thisstaff->getName()); + $ticket->logActivity(__('Ticket Marked Overdue'),$msg); } else { - $errors['err']='Problems marking the the ticket overdue. Try again'; + $errors['err']=__('Problems marking the the ticket overdue. Try again'); } break; case 'answered': $dept = $ticket->getDept(); if(!$dept || !$dept->isManager($thisstaff)) { - $errors['err']='Perm. Denied. You are not allowed to flag tickets'; + $errors['err']=__('Perm. Denied. You are not allowed to flag tickets'); } elseif($ticket->markAnswered()) { - $msg='Ticket flagged as answered'; - $ticket->logActivity('Ticket Marked Answered',($msg.' by '.$thisstaff->getName())); + $msg=sprintf(__('Ticket flagged as answered by %s'),$thisstaff->getName()); + $ticket->logActivity(__('Ticket Marked Answered'),$msg); } else { - $errors['err']='Problems marking the the ticket answered. Try again'; + $errors['err']=__('Problems marking the the ticket answered. Try again'); } break; case 'unanswered': $dept = $ticket->getDept(); if(!$dept || !$dept->isManager($thisstaff)) { - $errors['err']='Perm. Denied. You are not allowed to flag tickets'; + $errors['err']=__('Perm. Denied. You are not allowed to flag tickets'); } elseif($ticket->markUnAnswered()) { - $msg='Ticket flagged as unanswered'; - $ticket->logActivity('Ticket Marked Unanswered',($msg.' by '.$thisstaff->getName())); + $msg=sprintf(__('Ticket flagged as unanswered by %s'),$thisstaff->getName()); + $ticket->logActivity(__('Ticket Marked Unanswered'),$msg); } else { - $errors['err']='Problems marking the the ticket unanswered. Try again'; + $errors['err']=__('Problems marking the the ticket unanswered. Try again'); } break; case 'banemail': if(!$thisstaff->canBanEmails()) { - $errors['err']='Perm. Denied. You are not allowed to ban emails'; + $errors['err']=__('Perm. Denied. You are not allowed to ban emails'); } elseif(BanList::includes($ticket->getEmail())) { - $errors['err']='Email already in banlist'; + $errors['err']=__('Email already in banlist'); } elseif(Banlist::add($ticket->getEmail(),$thisstaff->getName())) { - $msg='Email ('.$ticket->getEmail().') added to banlist'; + $msg=sprintf(__('Email %s added to banlist'),$ticket->getEmail()); } else { - $errors['err']='Unable to add the email to banlist'; + $errors['err']=__('Unable to add the email to banlist'); } break; case 'unbanemail': if(!$thisstaff->canBanEmails()) { - $errors['err'] = 'Perm. Denied. You are not allowed to remove emails from banlist.'; + $errors['err'] = __('Perm. Denied. You are not allowed to remove emails from banlist.'); } elseif(Banlist::remove($ticket->getEmail())) { - $msg = 'Email removed from banlist'; + $msg = __('Email removed from banlist'); } elseif(!BanList::includes($ticket->getEmail())) { - $warn = 'Email is not in the banlist'; + $warn = __('Email is not in the banlist'); } else { - $errors['err']='Unable to remove the email from banlist. Try again.'; + $errors['err']=__('Unable to remove the email from banlist. Try again.'); } break; case 'delete': // Dude what are you trying to hide? bad customer support?? if(!$thisstaff->canDeleteTickets()) { - $errors['err']='Perm. Denied. You are not allowed to DELETE tickets!!'; + $errors['err']=__('Perm. Denied. You are not allowed to DELETE tickets!!'); } elseif($ticket->delete()) { - $msg='Ticket #'.$ticket->getNumber().' deleted successfully'; + $msg=sprintf(__('Ticket #%d deleted successfully'),$ticket->getNumber()); //Log a debug note - $ost->logDebug('Ticket #'.$ticket->getNumber().' deleted', - sprintf('Ticket #%s deleted by %s', + $ost->logDebug(sprintf(__('Ticket #%d deleted'),$ticket->getNumber()), + sprintf(__('Ticket #%1$s deleted by %2$s'), $ticket->getNumber(), $thisstaff->getName()) ); $ticket=null; //clear the object. } else { - $errors['err']='Problems deleting the ticket. Try again'; + $errors['err']=__('Problems deleting the ticket. Try again'); } break; default: - $errors['err']='You must select action to perform'; + $errors['err']=__('You must select action to perform'); endswitch; break; default: - $errors['err']='Unknown action'; + $errors['err']=__('Unknown action'); endswitch; if($ticket && is_object($ticket)) $ticket->reload();//Reload ticket info following post processing @@ -345,68 +343,68 @@ switch($_POST['a']) { case 'mass_process': if(!$thisstaff->canManageTickets()) - $errors['err']='You do not have permission to mass manage tickets. Contact admin for such access'; + $errors['err']=__('You do not have permission to mass manage tickets. Contact admin for such access'); elseif(!$_POST['tids'] || !is_array($_POST['tids'])) - $errors['err']='No tickets selected. You must select at least one ticket.'; + $errors['err']=__('No tickets selected. You must select at least one ticket.'); else { $count=count($_POST['tids']); $i = 0; switch(strtolower($_POST['do'])) { case 'reopen': if($thisstaff->canCloseTickets() || $thisstaff->canCreateTickets()) { - $note='Ticket reopened by '.$thisstaff->getName(); + $note=sprintf(__('Ticket reopened by %s'),$thisstaff->getName()); foreach($_POST['tids'] as $k=>$v) { if(($t=Ticket::lookup($v)) && $t->isClosed() && @$t->reopen()) { $i++; - $t->logNote('Ticket Reopened', $note, $thisstaff); + $t->logNote(__('Ticket Reopened'), $note, $thisstaff); } } if($i==$count) - $msg = "Selected tickets ($i) reopened successfully"; + $msg = sprintf(__('Selected tickets %d reopened successfully'),$i); elseif($i) - $warn = "$i of $count selected tickets reopened"; + $warn = sprintf(__('%1$d of %2$d selected tickets reopened'),$i, $count); else - $errors['err'] = 'Unable to reopen selected tickets'; + $errors['err'] = __('Unable to reopen selected tickets'); } else { - $errors['err'] = 'You do not have permission to reopen tickets'; + $errors['err'] = __('You do not have permission to reopen tickets'); } break; case 'close': if($thisstaff->canCloseTickets()) { - $note='Ticket closed without response by '.$thisstaff->getName(); + $note=sprintf(__('Ticket closed without response by %s'),$thisstaff->getName()); foreach($_POST['tids'] as $k=>$v) { if(($t=Ticket::lookup($v)) && $t->isOpen() && @$t->close()) { $i++; - $t->logNote('Ticket Closed', $note, $thisstaff); + $t->logNote(__('Ticket Closed'), $note, $thisstaff); } } if($i==$count) - $msg ="Selected tickets ($i) closed succesfully"; + $msg =sprintf(__('Selected tickets (%d) closed successfully'),$i); elseif($i) - $warn = "$i of $count selected tickets closed"; + $warn = sprintf(__('%1$d of %2$d selected tickets closed'),$i, $count); else - $errors['err'] = 'Unable to close selected tickets'; + $errors['err'] = __('Unable to close selected tickets'); } else { - $errors['err'] = 'You do not have permission to close tickets'; + $errors['err'] = __('You do not have permission to close tickets'); } break; case 'mark_overdue': - $note='Ticket flagged as overdue by '.$thisstaff->getName(); + $note=sprintf(__('Ticket flagged as overdue by %s'),$thisstaff->getName()); foreach($_POST['tids'] as $k=>$v) { if(($t=Ticket::lookup($v)) && !$t->isOverdue() && $t->markOverdue()) { $i++; - $t->logNote('Ticket Marked Overdue', $note, $thisstaff); + $t->logNote(__('Ticket Marked Overdue'), $note, $thisstaff); } } if($i==$count) - $msg = "Selected tickets ($i) marked overdue"; + $msg = sprintf(__('Selected tickets (%d) marked overdue'), $i); elseif($i) - $warn = "$i of $count selected tickets marked overdue"; + $warn = sprintf(__('%1$d of %2$d selected tickets marked overdue'), $i, $count); else - $errors['err'] = 'Unable to flag selected tickets as overdue'; + $errors['err'] = __('Unable to flag selected tickets as overdue'); break; case 'delete': if($thisstaff->canDeleteTickets()) { @@ -416,43 +414,43 @@ //Log a warning if($i) { - $log = sprintf('%s (%s) just deleted %d ticket(s)', + $log = sprintf(__('%1$s (%2$s) just deleted %3$d ticket(s)'), $thisstaff->getName(), $thisstaff->getUserName(), $i); - $ost->logWarning('Tickets deleted', $log, false); + $ost->logWarning(__('Tickets deleted'), $log, false); } if($i==$count) - $msg = "Selected tickets ($i) deleted successfully"; + $msg = sprintf(__('Selected tickets (%d) deleted successfully'),$i); elseif($i) - $warn = "$i of $count selected tickets deleted"; + $warn = sprintf(__('%1$d of %2$d selected tickets deleted'),$i, $count); else - $errors['err'] = 'Unable to delete selected tickets'; + $errors['err'] = __('Unable to delete selected tickets'); } else { - $errors['err'] = 'You do not have permission to delete tickets'; + $errors['err'] = __('You do not have permission to delete tickets'); } break; default: - $errors['err']='Unknown or unsupported action - get technical help'; + $errors['err']=__('Unknown or unsupported action - get technical help'); } } break; case 'open': $ticket=null; if(!$thisstaff || !$thisstaff->canCreateTickets()) { - $errors['err']='You do not have permission to create tickets. Contact admin for such access'; + $errors['err']=__('You do not have permission to create tickets. Contact admin for such access'); } else { $vars = $_POST; if($_FILES['attachments']) $vars['files'] = AttachmentFile::format($_FILES['attachments']); if(($ticket=Ticket::open($vars, $errors))) { - $msg='Ticket created successfully'; + $msg=__('Ticket created successfully'); $_REQUEST['a']=null; if(!$ticket->checkStaffAccess($thisstaff) || $ticket->isClosed()) $ticket=null; } elseif(!$errors['err']) { - $errors['err']='Unable to create the ticket. Correct the error(s) and try again'; + $errors['err']=__('Unable to create the ticket. Correct the error(s) and try again'); } } break; @@ -468,24 +466,24 @@ //Navigation $nav->setTabActive('tickets'); if($cfg->showAnsweredTickets()) { - $nav->addSubMenu(array('desc'=>'Open ('.number_format($stats['open']+$stats['answered']).')', - 'title'=>'Open Tickets', + $nav->addSubMenu(array('desc'=>__('Open').' ('.number_format($stats['open']+$stats['answered']).')', + 'title'=>__('Open Tickets'), 'href'=>'tickets.php', 'iconclass'=>'Ticket'), (!$_REQUEST['status'] || $_REQUEST['status']=='open')); } else { if($stats) { - $nav->addSubMenu(array('desc'=>'Open ('.number_format($stats['open']).')', - 'title'=>'Open Tickets', + $nav->addSubMenu(array('desc'=>__('Open').' ('.number_format($stats['open']).')', + 'title'=>__('Open Tickets'), 'href'=>'tickets.php', 'iconclass'=>'Ticket'), (!$_REQUEST['status'] || $_REQUEST['status']=='open')); } if($stats['answered']) { - $nav->addSubMenu(array('desc'=>'Answered ('.number_format($stats['answered']).')', - 'title'=>'Answered Tickets', + $nav->addSubMenu(array('desc'=>__('Answered').' ('.number_format($stats['answered']).')', + 'title'=>__('Answered Tickets'), 'href'=>'tickets.php?status=answered', 'iconclass'=>'answeredTickets'), ($_REQUEST['status']=='answered')); @@ -494,43 +492,43 @@ if($stats['assigned']) { if(!$ost->getWarning() && $stats['assigned']>10) - $ost->setWarning($stats['assigned'].' tickets assigned to you! Do something about it!'); + $ost->setWarning(sprintf(__('%d tickets assigned to you! Do something about it!'),$stats['assigned'])); - $nav->addSubMenu(array('desc'=>'My Tickets ('.number_format($stats['assigned']).')', - 'title'=>'Assigned Tickets', + $nav->addSubMenu(array('desc'=>__('My Tickets').' ('.number_format($stats['assigned']).')', + 'title'=>__('Assigned Tickets'), 'href'=>'tickets.php?status=assigned', 'iconclass'=>'assignedTickets'), ($_REQUEST['status']=='assigned')); } if($stats['overdue']) { - $nav->addSubMenu(array('desc'=>'Overdue ('.number_format($stats['overdue']).')', - 'title'=>'Stale Tickets', + $nav->addSubMenu(array('desc'=>__('Overdue').' ('.number_format($stats['overdue']).')', + 'title'=>__('Stale Tickets'), 'href'=>'tickets.php?status=overdue', 'iconclass'=>'overdueTickets'), ($_REQUEST['status']=='overdue')); if(!$sysnotice && $stats['overdue']>10) - $sysnotice=$stats['overdue'] .' overdue tickets!'; + $sysnotice=sprintf(__('%d overdue tickets!'),$stats['overdue']); } if($thisstaff->showAssignedOnly() && $stats['closed']) { - $nav->addSubMenu(array('desc'=>'My Closed Tickets ('.number_format($stats['closed']).')', - 'title'=>'My Closed Tickets', + $nav->addSubMenu(array('desc'=>__('My Closed Tickets').' ('.number_format($stats['closed']).')', + 'title'=>__('My Closed Tickets'), 'href'=>'tickets.php?status=closed', 'iconclass'=>'closedTickets'), ($_REQUEST['status']=='closed')); } else { - $nav->addSubMenu(array('desc'=>'Closed Tickets ('.number_format($stats['closed']).')', - 'title'=>'Closed Tickets', + $nav->addSubMenu(array('desc'=>__('Closed Tickets').' ('.number_format($stats['closed']).')', + 'title'=>__('Closed Tickets'), 'href'=>'tickets.php?status=closed', 'iconclass'=>'closedTickets'), ($_REQUEST['status']=='closed')); } if($thisstaff->canCreateTickets()) { - $nav->addSubMenu(array('desc'=>'New Ticket', + $nav->addSubMenu(array('desc'=>__('New Ticket'), 'href'=>'tickets.php?a=open', 'iconclass'=>'newTicket'), ($_REQUEST['a']=='open')); @@ -539,26 +537,26 @@ $inc = 'tickets.inc.php'; if($ticket) { - $ost->setPageTitle('Ticket #'.$ticket->getNumber()); + $ost->setPageTitle(sprintf(__('Ticket #%d'),$ticket->getNumber())); $nav->setActiveSubMenu(-1); $inc = 'ticket-view.inc.php'; if($_REQUEST['a']=='edit' && $thisstaff->canEditTickets()) $inc = 'ticket-edit.inc.php'; elseif($_REQUEST['a'] == 'print' && !$ticket->pdfExport($_REQUEST['psize'], $_REQUEST['notes'])) - $errors['err'] = 'Internal error: Unable to export the ticket to PDF for print.'; + $errors['err'] = __('Internal error: Unable to export the ticket to PDF for print.'); } else { - $inc = 'tickets.inc.php'; + $inc = 'tickets.inc.php'; if($_REQUEST['a']=='open' && $thisstaff->canCreateTickets()) $inc = 'ticket-open.inc.php'; elseif($_REQUEST['a'] == 'export') { require_once(INCLUDE_DIR.'class.export.php'); $ts = strftime('%Y%m%d'); if (!($token=$_REQUEST['h'])) - $errors['err'] = 'Query token required'; + $errors['err'] = __('Query token required'); elseif (!($query=$_SESSION['search_'.$token])) - $errors['err'] = 'Query token not found'; + $errors['err'] = __('Query token not found'); elseif (!Export::saveTickets($query, "tickets-$ts.csv", 'csv')) - $errors['err'] = 'Internal error: Unable to dump query results'; + $errors['err'] = __('Internal error: Unable to dump query results'); } //Clear active submenu on search with no status diff --git a/scp/upgrade.php b/scp/upgrade.php index c66230a2..b623515f 100644 --- a/scp/upgrade.php +++ b/scp/upgrade.php @@ -23,13 +23,13 @@ switch(strtolower($_POST['s'])) { case 'prereq': if(!$ost->isUpgradePending()) { - $errors['err']=' Nothing to do! System already upgraded to the current version'; + $errors['err']=__('Nothing to do! System already upgraded to the current version'); } elseif(!$upgrader->isUpgradable()) { - $errors['err']='The upgrader does NOT support upgrading from the current vesion!'; + $errors['err']=__('The upgrader does NOT support upgrading from the current vesion!'); } elseif(!$upgrader->check_prereq()) { - $errors['prereq']='Minimum requirements not met! Refer to Release Notes for more information'; + $errors['prereq']=__('Minimum requirements not met! Refer to Release Notes for more information'); } elseif(!strcasecmp(basename(CONFIG_FILE), 'settings.php')) { - $errors['err']='Config file rename required to continue!'; + $errors['err']=__('Config file rename required to continue!'); } else { $upgrader->setState('upgrade'); } @@ -48,7 +48,7 @@ } break; default: - $errors['err']='Unknown action!'; + $errors['err']=__('Unknown action!'); } } @@ -69,9 +69,9 @@ elseif(!strcasecmp(basename(CONFIG_FILE), 'settings.php')) $inc='rename.inc.php'; elseif(!$ost->isUpgradePending()) - $errors['err']='Nothing to do! System already upgraded to '.$ost->getVersion().' with no pending patches to apply.'; + $errors['err']=sprintf(__('Nothing to do! System already upgraded to %s with no pending patches to apply.'),$ost->getVersion()); elseif(!$upgrader->isUpgradable()) - $errors['err']=sprintf('The upgrader does NOT support upgrading from the current patch [%s]!', $cfg->getSchemaSignature()); + $errors['err']=sprintf(__('The upgrader does NOT support upgrading from the current patch [%s]!'), $cfg->getSchemaSignature()); } diff --git a/setup/inc/class.installer.php b/setup/inc/class.installer.php index 178f310e..5cc109dd 100644 --- a/setup/inc/class.installer.php +++ b/setup/inc/class.installer.php @@ -44,7 +44,6 @@ function check_config() { function install($vars) { $this->errors=$f=array(); - $f['name'] = array('type'=>'string', 'required'=>1, 'error'=>'Name required'); $f['email'] = array('type'=>'email', 'required'=>1, 'error'=>'Valid email required'); $f['fname'] = array('type'=>'string', 'required'=>1, 'error'=>'First name required'); @@ -59,9 +58,8 @@ function install($vars) { $f['dbuser'] = array('type'=>'string', 'required'=>1, 'error'=>'Username required'); $f['dbpass'] = array('type'=>'string', 'required'=>1, 'error'=>'password required'); - if(!Validator::process($f,$vars,$this->errors) && !$this->errors['err']) - $this->errors['err']='Missing or invalid data - correct the errors and try again.'; + $this->errors['err']=__('Missing or invalid data - correct the errors and try again.'); //Staff's email can't be same as system emails. @@ -69,26 +67,26 @@ function install($vars) { $this->errors['admin_email']='Conflicts with system email above'; //Admin's pass confirmation. if(!$this->errors && strcasecmp($vars['passwd'],$vars['passwd2'])) - $this->errors['passwd2']='passwords to not match!'; + $this->errors['passwd2']=__('Password(s) do not match'); //Check table prefix underscore required at the end! if($vars['prefix'] && substr($vars['prefix'], -1)!='_') - $this->errors['prefix']='Bad prefix. Must have underscore (_) at the end. e.g \'ost_\''; + $this->errors['prefix']=__('Bad prefix. Must have underscore (_) at the end. e.g \'ost_\''); //Make sure admin username is not very predictable. XXX: feels dirty but necessary if(!$this->errors['username'] && in_array(strtolower($vars['username']),array('admin','admins','username','osticket'))) - $this->errors['username']='Bad username'; + $this->errors['username']=__('Bad username'); //MYSQL: Connect to the DB and check the version & database (create database if it doesn't exist!) if(!$this->errors) { if(!db_connect($vars['dbhost'],$vars['dbuser'],$vars['dbpass'])) $this->errors['db']='Unable to connect to MySQL server. '.db_connect_error(); elseif(db_version()< $this->getMySQLVersion()) - $this->errors['db']=sprintf('osTicket requires MySQL %s or better!',$this->getMySQLVersion()); + $this->errors['db']=sprintf(__('osTicket requires MySQL %s or better!'),$this->getMySQLVersion()); elseif(!db_select_database($vars['dbname']) && !db_create_database($vars['dbname'])) { - $this->errors['dbname']='Database doesn\'t exist'; - $this->errors['db']='Unable to create the database.'; + $this->errors['dbname']=__('Database doesn\'t exist'); + $this->errors['db']=__('Unable to create the database.'); } elseif(!db_select_database($vars['dbname'])) { - $this->errors['dbname']='Unable to select the database'; + $this->errors['dbname']=__('Unable to select the database'); } else { //Abort if we have another installation (or table) with same prefix. $sql = 'SELECT * FROM `'.$vars['prefix'].'config` LIMIT 1'; @@ -122,9 +120,9 @@ function install($vars) { $this->errors['err']='Unknown or invalid schema signature (' .$signature.' .. '.$hash.')'; elseif(!file_exists($this->getConfigFile()) || !($configFile=file_get_contents($this->getConfigFile()))) - $this->errors['err']='Unable to read config file. Permission denied! (#2)'; + $this->errors['err']=__('Unable to read config file. Permission denied! (#2)'); elseif(!($fp = @fopen($this->getConfigFile(),'r+'))) - $this->errors['err']='Unable to open config file for writing. Permission denied! (#3)'; + $this->errors['err']=__('Unable to open config file for writing. Permission denied! (#3)'); elseif(!$this->load_sql_file($schemaFile,$vars['prefix'], true, $debug)) $this->errors['err']='Error parsing SQL schema! Get help from developers (#4)'; @@ -201,7 +199,7 @@ function install($vars) { $configFile= str_replace('%CONFIG-PREFIX',$vars['prefix'],$configFile); $configFile= str_replace('%CONFIG-SIRI',Misc::randcode(32),$configFile); if(!$fp || !ftruncate($fp,0) || !fwrite($fp,$configFile)) { - $this->errors['err']='Unable to write to config file. Permission denied! (#5)'; + $this->errors['err']=__('Unable to write to config file. Permission denied! (#5)'); return false; } @fclose($fp); @@ -236,7 +234,7 @@ function install($vars) { //TODO: create another personalized ticket and assign to admin?? //Log a message. - $msg="Congratulations osTicket basic installation completed!\n\nThank you for choosing osTicket!"; + $msg=__("Congratulations osTicket basic installation completed!\n\nThank you for choosing osTicket!"); $sql='INSERT INTO '.PREFIX.'syslog SET created=NOW(), updated=NOW(), log_type="Debug" ' .', title="osTicket installed!"' .', log='.db_input($msg) diff --git a/setup/inc/file-missing.inc.php b/setup/inc/file-missing.inc.php index 2c84883c..2a4fdde4 100644 --- a/setup/inc/file-missing.inc.php +++ b/setup/inc/file-missing.inc.php @@ -2,29 +2,29 @@ if(!defined('SETUPINC')) die('Kwaheri!'); ?>
-

Configuration file missing!

+

-

osTicket installer requires ability to write to the configuration file, include/ost-config.php. A template copy is located in the include directory (include/ost-sampleconfig.php). +

include/ost-config.php. A template copy is located in the include directory (include/ost-sampleconfig.php).');?>

-

Solution:

- Rename the sample file include/ost-sampleconfig.php to ost-config.php and click continue below. +

:

+ include/ost-sampleconfig.php to ost-config.php and click continue below.');?> -

If sample config file is missing - please make sure you uploaded all files in 'upload' folder or refer to the Installation Guide

+

','');?>

- +
diff --git a/setup/inc/file-perm.inc.php b/setup/inc/file-perm.inc.php index 6a158082..c823da4e 100644 --- a/setup/inc/file-perm.inc.php +++ b/setup/inc/file-perm.inc.php @@ -2,31 +2,31 @@ if(!defined('SETUPINC')) die('Kwaheri!'); ?>
-

Configuration file is not writable

+

- osTicket installer requires ability to write to the configuration file include/ost-config.php. + include/ost-config.php. ');?>

-

Solution:

- Please follow the instructions below to give read and write access to the web server user. +

:

+ -

Don't worry! We'll remind you to take away the write access post-install.

+

.

- +
diff --git a/setup/inc/file-unclean.inc.php b/setup/inc/file-unclean.inc.php index 3c194b60..3e558050 100644 --- a/setup/inc/file-unclean.inc.php +++ b/setup/inc/file-unclean.inc.php @@ -2,17 +2,17 @@ if(!defined('SETUPINC')) die('Kwaheri!'); ?>
-

osTicket is already installed?

+

-

Configuration file already changed - which could mean osTicket is already installed or the config file is currupted. If you are trying to upgrade osTicket, then go to Admin Panel.

+

', '');?>

-

If you believe this is in error, please try replacing the config file with a unchanged template copy and try again or get technical help.

-

Refer to the Installation Guide on the wiki for more information.

+

+

', '');?>

diff --git a/setup/inc/header.inc.php b/setup/inc/header.inc.php index 4c7d16e0..6659db4c 100644 --- a/setup/inc/header.inc.php +++ b/setup/inc/header.inc.php @@ -20,7 +20,7 @@ foreach($wizard['menu'] as $k=>$v) echo sprintf('%s — ',$v,$k); ?> - Contact Us + diff --git a/setup/inc/install-done.inc.php b/setup/inc/install-done.inc.php index 3aaf5caf..55c9e503 100644 --- a/setup/inc/install-done.inc.php +++ b/setup/inc/install-done.inc.php @@ -3,46 +3,46 @@ ?>
-

Congratulations!

+

-

Your osTicket installation has been completed successfully. Your next step is to fully configure your new support ticket system for use, but before you get to it please take a minute to cleanup.

+

-

Config file permission:

- Change permission of ost-config.php to remove write access as shown below. +

:

+
    -
  • CLI:
    chmod 0664 include/ost-config.php
  • -
  • FTP:
    Using WS_FTP this would be right hand clicking on the file, selecting chmod, and then remove write access
  • -
  • Cpanel:
    Click on the file, select change permission, and then remove write access.
  • +
  • :
    chmod 0664 include/ost-config.php
  • +
  • :
  • +
  • :
-

Below, you'll find some useful links regarding your installation.

+

-

PS: Don't just make customers happy, make happy customers!

+

PS:

diff --git a/setup/inc/install-prereq.inc.php b/setup/inc/install-prereq.inc.php index 11746eda..fa9f3ae6 100644 --- a/setup/inc/install-prereq.inc.php +++ b/setup/inc/install-prereq.inc.php @@ -4,38 +4,59 @@ ?>
-

Thank You for Choosing osTicket!

+

-

We are delighted you have chosen osTicket for your customer support ticketing system!

-

The installer will guide you every step of the way in the installation process. You're minutes away from your awesome customer support system!

+

+

-

Prerequisites.

-

Before we begin, we'll check your server configuration to make sure you meet the minimum requirements to install and run osTicket.

-

Required:

- These items are necessary in order to install and use osTicket. +

.

+

+

:

+ -

Recommended:

- You can use osTicket without these, but you may not be able to use all features. +

:

+ + ERROR: The translation file "include/locale/'.$language.'/LC_MESSAGES/messages.mo" isn\'t readable, check permissions.
'; + } + else + { + fclose($f); + } + error_reporting($old_error_reporting); + } + ?>
- +
diff --git a/setup/inc/install.inc.php b/setup/inc/install.inc.php index cb5f2d82..5a26cab5 100644 --- a/setup/inc/install.inc.php +++ b/setup/inc/install.inc.php @@ -3,112 +3,112 @@ $info=($_POST && $errors)?Format::htmlchars($_POST):array('prefix'=>'ost_','dbhost'=>'localhost'); ?>
-

osTicket Basic Installation

-

Please fill out the information below to continue your osTicket installation. All fields are required.

+

+

-

System Settings

- The URL of your helpdesk, its name, and the default system email address +

+
- +
- + ?
- + ?
-

Admin User

- Your primary administrator account - you can add more users later. +

+
- + ?
- + ?
- + ?
- + ?
- + ?
- + ?
-

Database Settings

- Database connection information +

+
- + ?
- + ?
- + ?
- + ?
- + ?

- +
-

Need Help? We provide professional installation services and commercial support. Learn More!

+

professional installation services and commercial support.');?>

-

Doing stuff!

- Please wait... while we install your new support ticket system! +

+
diff --git a/setup/inc/subscribe.inc.php b/setup/inc/subscribe.inc.php index 45dddf1d..94745bee 100644 --- a/setup/inc/subscribe.inc.php +++ b/setup/inc/subscribe.inc.php @@ -2,47 +2,47 @@ $info=($_POST && $errors)?Format::htmlchars($_POST):$_SESSION['info']; ?>
-

Basic Installation Completed

-

osTicket installation has been completed successfully.

-

Stay up to date:

- It's important to keep your installation up to date. Get announcements, security updates and alerts delivered directly to you! +

+

+

:

+

- +
- +

- I'd like to receive the following notifications: + : + +
- - No thanks. + +
diff --git a/setup/install.php b/setup/install.php index 497d3781..d5df0df4 100644 --- a/setup/install.php +++ b/setup/install.php @@ -24,11 +24,11 @@ $installer = new Installer(OSTICKET_CONFIGFILE); //Installer instance. $wizard=array(); -$wizard['title']='osTicket Installer'; -$wizard['tagline']='Installing osTicket v'.$installer->getVersionVerbose(); +$wizard['title']=__('osTicket Installer'); +$wizard['tagline']=sprintf(__('Installing osTicket v%s'),$installer->getVersionVerbose()); $wizard['logo']='logo.png'; -$wizard['menu']=array('Installation Guide'=>'http://osticket.com/wiki/Installation', - 'Get Professional Help'=>'http://osticket.com/support'); +$wizard['menu']=array(__('Installation Guide')=>'http://osticket.com/wiki/Installation', + __('Get Professional Help')=>'http://osticket.com/support'); if($_POST && $_POST['s']) { $errors = array(); @@ -38,13 +38,13 @@ if($installer->check_prereq()) $_SESSION['ost_installer']['s']='config'; else - $errors['prereq']='Minimum requirements not met!'; + $errors['prereq']=__('Minimum requirements not met!'); break; case 'config': if(!$installer->config_exists()) - $errors['err']='Configuration file does NOT exist. Follow steps below to add one.'; + $errors['err']=__('Configuration file does NOT exist. Follow steps below to add one.'); elseif(!$installer->config_writable()) - $errors['err']='Write access required to continue'; + $errors['err']=__('Write access required to continue'); else $_SESSION['ost_installer']['s']='install'; break; @@ -56,20 +56,20 @@ //TODO: Go to subscribe step. $_SESSION['ost_installer']['s']='done'; } elseif(!($errors=$installer->getErrors()) || !$errors['err']) { - $errors['err']='Error installing osTicket - correct the errors below and try again.'; + $errors['err']=__('Error installing osTicket - correct the errors below and try again.'); } break; case 'subscribe': if(!trim($_POST['name'])) - $errors['name'] = 'Required'; + $errors['name'] = __('Required'); if(!$_POST['email']) - $errors['email'] = 'Required'; + $errors['email'] = __('Required'); elseif(!Validator::is_email($_POST['email'])) - $errors['email'] = 'Invalid'; + $errors['email'] = __('Invalid'); if(!$_POST['alerts'] && !$_POST['news']) - $errors['notify'] = 'Check one or more'; + $errors['notify'] = __('Check one or more'); if(!$errors) $_SESSION['ost_installer']['s'] = 'done'; diff --git a/setup/js/tips.js b/setup/js/tips.js index 76c20421..2f0ca884 100644 --- a/setup/js/tips.js +++ b/setup/js/tips.js @@ -18,7 +18,7 @@ jQuery(function($) { var tip_arrow = $('').attr('src', './images/tip_arrow.png').addClass('tip_arrow'); var tip_box = $('
').addClass('tip_box'); - var tip_content = $('
').addClass('tip_content').load('tips.html '+elem.attr('href'), function() { + var tip_content = $('
').addClass('tip_content').load('tips.php '+elem.attr('href'), function() { tip_content.prepend('x'); }); diff --git a/setup/setup.inc.php b/setup/setup.inc.php index ab75b721..9ee4d198 100644 --- a/setup/setup.inc.php +++ b/setup/setup.inc.php @@ -72,4 +72,5 @@ else require(INCLUDE_DIR.'mysql.php'); +require_once(INCLUDE_DIR.'gettext-conf.php'); ?> diff --git a/setup/tips.html b/setup/tips.html deleted file mode 100644 index 1cd8de93..00000000 --- a/setup/tips.html +++ /dev/null @@ -1,52 +0,0 @@ -
-Helpdesk Name -

The name of your support system e.g [Company Name] Support

-
-
-Default System Email -

Default email address e.g support@yourcompany.com - you can add more later!

-
-
-First Name -

Admin's first name

-
-
-Last Name -

Admin's last name

-
-
-Email Address -

Admin's personal email address. Must be different from system's default email.

-
-
-Username -

Admin's login name. Must be at least three (3) characters.

-
-
-Password -

Admin's password. Must be five (5) characters or more.

-
-
-Confirm Password -

Retype admin's password. Must match.

-
-
-MySQL Table Prefix. -

osTicket requires table prefix in order to avoid possible table conflicts in a shared database.

-
-
-MySQL Hostname -

Most hosts use 'localhost' for local database hostname. Check with your host if localhost fails. Default port set in php.ini is assumed.

-
-
-MySQL Database -

Name of the database osTicket will use.

-
-
-MySQL Username -

The MySQL user must have full rights to the database.

-
-
-MySQL Password -

MySQL password associated with above user.

-
diff --git a/setup/tips.php b/setup/tips.php new file mode 100644 index 00000000..f2722d1d --- /dev/null +++ b/setup/tips.php @@ -0,0 +1,62 @@ + + + + + + +
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+
+ +

+
+ + \ No newline at end of file diff --git a/testlang.php b/testlang.php new file mode 100644 index 00000000..52a36620 --- /dev/null +++ b/testlang.php @@ -0,0 +1,126 @@ + 1) { + # Split possible languages into array + $x = explode(",",$http_accept); + foreach ($x as $val) { + #check for q-value and create associative array. No q-value means 1 by rule + if(preg_match("/(.*);q=([0-1]{0,1}\.\d{0,4})/i",$val,$matches)) + $lang[$matches[1]] = (float)$matches[2]; + else + $lang[$val] = 1.0; + } + + #return default language (highest q-value) + $qval = 0.0; + foreach ($lang as $key => $value) { + if ($value > $qval) { + $qval = (float)$value; + $deflang = $key; + } + } + } + return strtolower($deflang); +} +$language=getDefaultLanguage(); +echo "Your browser preferred language is: '".$language."'
"; + +//get the first and second part of the language code +if(strpos($language,'_')!==false) +{ + $language=substr($language,0,strpos($language,'_')); + $lang_dialect=substr($language,strpos($language,'_')); +} +elseif(strpos($language,'-')!==false) +{ + $language=substr($language,0,strpos($language,'-')); + $lang_dialect=substr($language,strpos($language,'-')); +} +if(!isset($lang_dialect)) +{ + $lang_dialect=$language; +} +$tmplangcode=$language.'-'.strtolower($lang_dialect); +if(!file_exists('include/locale/'.$tmplangcode)||!is_dir('include/locale/'.$tmplangcode)) +{ + $tmplangcode=$language.'_'.strtolower($lang_dialect); + if(!file_exists('include/locale/'.$tmplangcode)||!is_dir('include/locale/'.$tmplangcode)) + { + $tmplangcode=$language.'_'.strtoupper($lang_dialect); + if(!file_exists('include/locale/'.$tmplangcode)||!is_dir('include/locale/'.$tmplangcode)) + { + $tmplangcode=$language.'-'.strtoupper($lang_dialect); + if(!file_exists('include/locale/'.$tmplangcode)||!is_dir('include/locale/'.$tmplangcode)) + { + if(!file_exists('include/locale/'.$language)||!is_dir('include/locale/'.$language)) //check short langcode + { + $language='en'; //set as default + } + } + else + { + $language=$tmplangcode; + } + } + else + { + $language=$tmplangcode; + } + } + else + { + $language=$tmplangcode; + } +} +else +{ + $language=$tmplangcode; +} +//check if a redirect file is in there +if(file_exists('include/locale/'.$language.'/redirect')) +{ + $f = fopen('include/locale/'.$language.'/redirect','r'); + if($f!==false) + { + $line = fgets($f); + if(strlen($line)>=2) //safety check + { + echo "using the redirect file include/locale/".$language."/redirect
"; + $language=$line; //redirect language + echo "redirecting to '".$language."'
"; + } + fclose($f); + } +} + +echo "The following folder will be used to translate your osticket: '".$language."'"; + + +$old_error_reporting = error_reporting(); +error_reporting (E_ERROR); +$f = fopen('include/locale/'.$language.'/LC_MESSAGES/messages.mo', 'r'); +$meta = stream_get_meta_data($f); +if($meta['mode']==NULL) +{ + echo '
ERROR: The translation file "include/locale/'.$language.'/LC_MESSAGES/messages.mo" isn\'t readable, check permissions.
'; +} +else +{ + fclose($f); +} +error_reporting($old_error_reporting); +?> \ No newline at end of file diff --git a/tickets.php b/tickets.php index d1293db8..b8451046 100644 --- a/tickets.php +++ b/tickets.php @@ -1,74 +1,74 @@ - - 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('secure.inc.php'); -if(!is_object($thisclient) || !$thisclient->isValid()) die('Access denied'); //Double check again. -require_once(INCLUDE_DIR.'class.ticket.php'); -$ticket=null; -if($_REQUEST['id']) { - if(!($ticket=Ticket::lookupByExtId($_REQUEST['id']))) { - $errors['err']='Unknown or invalid ticket ID.'; - }elseif(!$ticket->checkClientAccess($thisclient)) { - $errors['err']='Unknown or invalid ticket ID.'; //Using generic message on purpose! - $ticket=null; - } -} - -//Process post...depends on $ticket object above. -if($_POST && is_object($ticket) && $ticket->getId()): - $errors=array(); - switch(strtolower($_POST['a'])){ - case 'reply': - if(!$ticket->checkClientAccess($thisclient)) //double check perm again! - $errors['err']='Access Denied. Possibly invalid ticket ID'; - - if(!$_POST['message']) - $errors['message']='Message required'; - - if(!$errors) { - //Everything checked out...do the magic. - $vars = array('message'=>$_POST['message']); - if($cfg->allowOnlineAttachments() && $_FILES['attachments']) - $vars['files'] = AttachmentFile::format($_FILES['attachments'], true); - - if(($msgid=$ticket->postMessage($vars, 'Web'))) { - $msg='Message Posted Successfully'; - } else { - $errors['err']='Unable to post the message. Try again'; - } - - } elseif(!$errors['err']) { - $errors['err']='Error(s) occurred. Please try again'; - } - break; - default: - $errors['err']='Unknown action'; - } - $ticket->reload(); -endif; -$nav->setActiveNav('tickets'); -if($ticket && $ticket->checkClientAccess($thisclient)) { - $inc='view.inc.php'; -} elseif($cfg->showRelatedTickets() && $thisclient->getNumTickets()) { - $inc='tickets.inc.php'; -} else { - $nav->setActiveNav('new'); - $inc='open.inc.php'; -} -include(CLIENTINC_DIR.'header.inc.php'); -include(CLIENTINC_DIR.$inc); -include(CLIENTINC_DIR.'footer.inc.php'); -?> + + 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('secure.inc.php'); +if(!is_object($thisclient) || !$thisclient->isValid()) die('Access denied'); //Double check again. +require_once(INCLUDE_DIR.'class.ticket.php'); +$ticket=null; +if($_REQUEST['id']) { + if(!($ticket=Ticket::lookupByExtId($_REQUEST['id']))) { + $errors['err']=__('Unknown or invalid ticket ID.'); + }elseif(!$ticket->checkClientAccess($thisclient)) { + $errors['err']=__('Unknown or invalid ticket ID.'); //Using generic message on purpose! + $ticket=null; + } +} + +//Process post...depends on $ticket object above. +if($_POST && is_object($ticket) && $ticket->getId()): + $errors=array(); + switch(strtolower($_POST['a'])){ + case 'reply': + if(!$ticket->checkClientAccess($thisclient)) //double check perm again! + $errors['err']=__('Access Denied. Possibly invalid ticket ID'); + + if(!$_POST['message']) + $errors['message']=__('Message required'); + + if(!$errors) { + //Everything checked out...do the magic. + $vars = array('message'=>$_POST['message']); + if($cfg->allowOnlineAttachments() && $_FILES['attachments']) + $vars['files'] = AttachmentFile::format($_FILES['attachments'], true); + + if(($msgid=$ticket->postMessage($vars, 'Web'))) { + $msg=__('Message Posted Successfully'); + } else { + $errors['err']=__('Unable to post the message. Try again'); + } + + } elseif(!$errors['err']) { + $errors['err']=__('Error(s) occurred. Please try again'); + } + break; + default: + $errors['err']=__('Unknown action'); + } + $ticket->reload(); +endif; +$nav->setActiveNav('tickets'); +if($ticket && $ticket->checkClientAccess($thisclient)) { + $inc='view.inc.php'; +} elseif($cfg->showRelatedTickets() && $thisclient->getNumTickets()) { + $inc='tickets.inc.php'; +} else { + $nav->setActiveNav('new'); + $inc='open.inc.php'; +} +include(CLIENTINC_DIR.'header.inc.php'); +include(CLIENTINC_DIR.$inc); +include(CLIENTINC_DIR.'footer.inc.php'); +?>