Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n #842

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

i18n #842

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@
vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/

function clientLoginPage($msg='Unauthorized') {
Http::response(403,'Must login: '.Format::htmlchars($msg));
function clientLoginPage($msg=null) {
if(!$msg)
$msg = lang('unauthorized');
Http::response(403,lang('must_login').': '.Format::htmlchars($msg));
exit;
}

require('client.inc.php');
require_once(INCLUDE_DIR.'languages/language_control/languages_processor.php');

if(!defined('INCLUDE_DIR')) Http::response(500, 'Server configuration error');
if(!defined('INCLUDE_DIR')) Http::response(500, lang('server_conf_error'));
require_once INCLUDE_DIR.'/class.dispatcher.php';
require_once INCLUDE_DIR.'/class.ajax.php';

Expand Down
9 changes: 5 additions & 4 deletions api/cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@

vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
@chdir(realpath(dirname(__FILE__)).'/'); //Change dir.
/*@chdir(realpath(dirname(__FILE__)).'/'); //Change dir.
require('api.inc.php');
require_once(INCLUDE_DIR.'languages/language_control/languages_processor.php');
*/
require('api.inc.php');

if (!osTicket::is_cli())
die('cron.php only supports local cron calls - use http -> api/tasks/cron');
die('cron.php only_support_local http -> api/tasks/cron');

@chdir(realpath(dirname(__FILE__)).'/'); //Change dir.
require('api.inc.php');
require_once(INCLUDE_DIR.'api.cron.php');
LocalCronApiController::call();
?>
3 changes: 2 additions & 1 deletion api/pipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
ini_set('memory_limit', '256M'); //The concern here is having enough mem for emails with attachments.
@chdir(realpath(dirname(__FILE__)).'/'); //Change dir.
require('api.inc.php');
require_once(INCLUDE_DIR.'languages/language_control/languages_processor.php');

//Only local piping supported via pipe.php
if (!osTicket::is_cli())
die('pipe.php only supports local piping - use http -> api/tickets.email');
die('pipe.php '.lang('only_support_local_p').' http -> api/tickets.email');

require_once(INCLUDE_DIR.'api.tickets.php');
PipeApiController::process();
Expand Down
15 changes: 13 additions & 2 deletions assets/default/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ h2 {
#msg_error {
margin: 0;
padding: 5px 10px 5px 36px;
height: 16px;
line-height: 16px;
margin-bottom: 10px;
border: 1px solid #a00;
Expand Down Expand Up @@ -782,6 +781,7 @@ a.refresh {
}
.infoTable th {
text-align: left;
font-weight: bold;
}
#ticketThread table {
margin-top: 10px;
Expand All @@ -806,7 +806,7 @@ a.refresh {
background: #d8efff;
}
#ticketThread .response th {
background: #ddd;
background: #FFE0B3;
}
#ticketThread .info {
padding: 2px;
Expand All @@ -824,3 +824,14 @@ a.refresh {
background-position: 0 50%;
background-repeat: no-repeat;
}

#sysmsg{ position: absolute; width: 753px; top: 27px; padding: 5px 10px 5px 36px; height: 16px; line-height: 16px; margin-bottom: 10px; border: 1px solid #0a0; background: url('../images/icons/ok.png') 10px 50% no-repeat #e0ffe0; }
#sysmsg.error{
margin: 0;
padding: 5px 10px 5px 36px;
line-height: 16px;
margin-bottom: 10px;
border: 1px solid #a00;
background: url('../images/icons/error.png') 10px 50% no-repeat #fff0f0;
top: 40px;
}
5 changes: 3 additions & 2 deletions attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@
**********************************************************************/
require('secure.inc.php');
require_once(INCLUDE_DIR.'class.attachment.php');
require_once(INCLUDE_DIR.'languages/language_control/languages_processor.php');
//Basic checks
if(!$thisclient
|| !$_GET['id']
|| !$_GET['h']
|| !($attachment=Attachment::lookup($_GET['id']))
|| !($file=$attachment->getFile()))
die('Unknown attachment!');
die(lang('unknown_attach'));

//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');
die('unknown_attach');
//Download the file..
$file->download();

Expand Down
49 changes: 49 additions & 0 deletions autocomplete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

$thisdir=str_replace('\\\\', '/', realpath(dirname(__FILE__))).'/';
if(!file_exists($thisdir.'main.inc.php')) die(lang('fatal_error'));

require_once($thisdir.'main.inc.php');

function error($n = 403) {
header("HTTP/1.0 403 Forbidden");
die('access denied');
}

if( ! isset($_GET['method']) ){
error();
}

if( function_exists($_GET['method']))
{
$_GET['method']();
} else {
error();
}

function json_output($data = array()) {
header('Content-Type: application/json');
print json_encode($data);
}

// -----------------------------------------------
// Handle requst
// -----------------------------------------------

function user_ticket() {
$data = array('result' => true);

$sql='SELECT email, name, phone, phone_ext FROM `ost_ticket` WHERE '
. ' name LIKE(' . db_input('%'.$_POST['name'].'%') . ') GROUP BY name';

if(!($res=db_query($sql)) || !db_num_rows($res))
{
json_output(array('result' => false));
return;
}
while ($row = mysqli_fetch_assoc($res)){
$data['data'][] = $row;
}

json_output($data);
}
3 changes: 2 additions & 1 deletion client.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
if(!file_exists($thisdir.'main.inc.php')) die('Fatal Error.');

require_once($thisdir.'main.inc.php');
require_once(INCLUDE_DIR.'languages/language_control/languages_processor.php');

if(!defined('INCLUDE_DIR')) die('Fatal error');

Expand Down Expand Up @@ -60,7 +61,7 @@
if ($_POST && !$ost->checkCSRFToken()) {
@header('Location: index.php');
//just incase redirect fails
die('Action denied (400)!');
die(lang('action_denied').' (400)!');
}

/* Client specific defaults */
Expand Down
7 changes: 7 additions & 0 deletions css/ui-lightness/jquery-ui-1.8.18.custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,13 @@
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }

.ui-autocomplete {
position: absolute;
top: 0;
left: 0;
cursor: default;
}

/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
.ui-datepicker-cover {
display: none; /*sorry for IE5*/
Expand Down
4 changes: 3 additions & 1 deletion include/JSON.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@
* $value = $json->decode($input);
* </code>
*/
require_once(INCLUDE_DIR.'languages/language_control/languages_processor.php');

class Services_JSON
{
/**
Expand Down Expand Up @@ -417,7 +419,7 @@ function encode($var)
default:
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
? 'null'
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
: new Services_JSON_Error(gettype($var).' '.lang('cant_encode_json'));
}
}

Expand Down
72 changes: 36 additions & 36 deletions include/ajax.content.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@
**********************************************************************/

if(!defined('INCLUDE_DIR')) die('!');

class ContentAjaxAPI extends AjaxController {

function log($id) {

if($id && ($log=Log::lookup($id))) {
$content=sprintf('<div style="width:500px;">&nbsp;<strong>%s</strong><br><p>%s</p>
<hr><strong>Log Date:</strong> <em>%s</em> <strong>IP Address:</strong> <em>%s</em></div>',
<hr><strong>'.lang('log_date').':</strong> <em>%s</em> <strong>'.lang('ip_address').':</strong> <em>%s</em></div>',
$log->getTitle(),
Format::display(str_replace(',',', ',$log->getText())),
Format::db_daydatetime($log->getCreateDate()),
$log->getIP());
}else {
$content='<div style="width:295px;">&nbsp;<strong>Error:</strong>Unknown or invalid log ID</div>';
$content='<div style="width:295px;">&nbsp;<strong>Error:</strong>'.lang('unknown_log_id').'</div>';

}

return $content;
Expand All @@ -39,46 +40,45 @@ function ticket_variables() {
$content='
<div style="width:680px;">
<h2>Ticket Variables</h2>
Please note that non-base variables depend on the context of use. Visit osTicket Wiki for up-to-date documentation.
<br/>
'
.lang('non_base_var').
'<br/>
<table width="100%" border="0" cellspacing=1 cellpadding=2>
<tr><td width="55%" valign="top"><b>Base Variables</b></td><td><b>Other Variables</b></td></tr>
<tr><td width="55%" valign="top"><b>'.lang('base_variables').'</b></td><td><b>'.lang('other_variables').'</b></td></tr>
<tr>
<td width="55%" valign="top">
<table width="100%" border="0" cellspacing=1 cellpadding=1>
<tr><td width="130">%{ticket.id}</td><td>Ticket ID (internal ID)</td></tr>
<tr><td>%{ticket.number}</td><td>Ticket number (external ID)</td></tr>
<tr><td>%{ticket.email}</td><td>Email address</td></tr>
<tr><td>%{ticket.name}</td><td>Full name</td></tr>
<tr><td>%{ticket.subject}</td><td>Subject</td></tr>
<tr><td>%{ticket.phone}</td><td>Phone number | ext</td></tr>
<tr><td>%{ticket.status}</td><td>Status</td></tr>
<tr><td>%{ticket.priority}</td><td>Priority</td></tr>
<tr><td>%{ticket.assigned}</td><td>Assigned staff and/or team</td></tr>
<tr><td>%{ticket.create_date}</td><td>Date created</td></tr>
<tr><td>%{ticket.due_date}</td><td>Due date</td></tr>
<tr><td>%{ticket.close_date}</td><td>Date closed</td></tr>
<tr><td>%{ticket.auth_token}</td><td>Auth. token used for auto-login</td></tr>
<tr><td>%{ticket.client_link}</td><td>Client\'s ticket view link</td></tr>
<tr><td>%{ticket.staff_link}</td><td>Staff\'s ticket view link</td></tr>
<tr><td colspan="2" style="padding:5px 0 5px 0;"><em>Expandable Variables (See Wiki)</em></td></tr>
<tr><td>%{ticket.<b>topic</b>}</td><td>Help topic</td></tr>
<tr><td>%{ticket.<b>dept</b>}</td><td>Department</td></tr>
<tr><td>%{ticket.<b>staff</b>}</td><td>Assigned/closing staff</td></tr>
<tr><td>%{ticket.<b>team</b>}</td><td>Assigned/closing team</td></tr>
<tr><td width="130">%{ticket.id}</td><td>'.lang('ticket_id_int_id').'</td></tr>
<tr><td>%{ticket.number}</td><td>'.lang('ticket_number').'</td></tr>
<tr><td>%{ticket.email}</td><td>'.lang('email_address').'</td></tr>
<tr><td>%{ticket.name}</td><td>'.lang('full_name').'</td></tr>
<tr><td>%{ticket.subject}</td><td>'.lang('subject').'</td></tr>
<tr><td>%{ticket.phone}</td><td>'.lang('phone_number').' | '.lang('ext').'</td></tr>
<tr><td>%{ticket.status}</td><td>'.lang('status').'</td></tr>
<tr><td>%{ticket.priority}</td><td>'.lang('priority').'</td></tr>
<tr><td>%{ticket.assigned}</td><td>'.lang('assigned_st_te').'</td></tr>
<tr><td>%{ticket.create_date}</td><td>'.lang('date_created').'</td></tr>
<tr><td>%{ticket.due_date}</td><td>'.lang('due_date').'</td></tr>
<tr><td>%{ticket.close_date}</td><td>'.lang('date_closed').'</td></tr>
<tr><td>%{ticket.auth_token}</td><td>'.lang('auth_used').'</td></tr>
<tr><td>%{ticket.client_link}</td><td>'.lang('client_view_link').'</td></tr>
<tr><td>%{ticket.staff_link}</td><td>'.lang('staff_view_link').'</td></tr>
<tr><td colspan="2" style="padding:5px 0 5px 0;"><em>'.lang('expan_var').'</em></td></tr>
<tr><td>%{ticket.<b>topic</b>}</td><td>'.lang('help_topic').'</td></tr>
<tr><td>%{ticket.<b>dept</b>}</td><td>'.lang('department').'</td></tr>
<tr><td>%{ticket.<b>staff</b>}</td><td>'.lang('assigned_c_staff').'</td></tr>
<tr><td>%{ticket.<b>team</b>}</td><td>'.lang('assigned_closing').'</td></tr>
</table>
</td>
<td valign="top">
<table width="100%" border="0" cellspacing=1 cellpadding=1>
<tr><td width="100">%{message}</td><td>Incoming message</td></tr>
<tr><td>%{response}</td><td>Outgoing response</td></tr>
<tr><td>%{comments}</td><td>Assign/transfer comments</td></tr>
<tr><td>%{note}</td><td>Internal note <em>(expandable)</em></td></tr>
<tr><td>%{assignee}</td><td>Assigned staff/team</td></tr>
<tr><td>%{assigner}</td><td>Staff assigning the ticket</td></tr>
<tr><td>%{url}</td><td>osTicket\'s base url (FQDN)</td></tr>
<tr><td>%{reset_link}</td>
<td>Reset link used by the password reset feature</td></tr>
<tr><td width="100">%{message}</td><td>'.lang('incoming_message').'</td></tr>
<tr><td>%{response}</td><td>'.lang('outgoing_response').'</td></tr>
<tr><td>%{comments}</td><td>'.lang('assign_comments').'</td></tr>
<tr><td>%{note}</td><td>'.lang('no_note').' <em>('.lang('expandable').')</em></td></tr>
<tr><td>%{assignee}</td><td>'.lang('assigned_st_te').'</td></tr>
<tr><td>%{assigner}</td><td>'.lang('staff_assigning').'</td></tr>
<tr><td>%{url}</td><td>'.lang('fqdn').'</td></tr>
</table>
</td>
</tr>
Expand Down
23 changes: 11 additions & 12 deletions include/ajax.kbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
if(!defined('INCLUDE_DIR')) die('!');


require_once(INCLUDE_DIR.'languages/language_control/languages_processor.php');
class KbaseAjaxAPI extends AjaxController {

function cannedResp($id, $format='') {
global $thisstaff, $_GET;

include_once(INCLUDE_DIR.'class.canned.php');

if(!$id || !($canned=Canned::lookup($id)) || !$canned->isEnabled())
Http::response(404, 'No such premade reply');
Http::response(404, lang('no_premade_reply'));

//Load ticket.
if($_GET['tid']) {
Expand Down Expand Up @@ -52,33 +52,32 @@ function cannedResp($id, $format='') {
}

function faq($id, $format='html') {
//XXX: user ajax->getThisStaff() (nolint)
global $thisstaff;
global $thisstaff; //XXX: user ajax->getThisStaff()
include_once(INCLUDE_DIR.'class.faq.php');

if(!($faq=FAQ::lookup($id)))
return null;

//TODO: $fag->getJSON() for json format. (nolint)
//TODO: $fag->getJSON() for json format.
$resp = sprintf(
'<div style="width:650px;">
<strong>%s</strong><p>%s</p>
<div class="faded">Last updated %s</div>
<div class="faded">'.lang('last_update').' %s</div>
<hr>
<a href="faq.php?id=%d">View</a> | <a href="faq.php?id=%d">Attachments (%s)</a>',
$faq->getQuestion(),
<a href="faq.php?id=%d">'.lang('view').'</a> | <a href="faq.php?id=%d">'.lang('attachments').' (%s)</a>',
$faq->getQuestion(),
Format::safe_html($faq->getAnswer()),
Format::db_daydatetime($faq->getUpdateDate()),
$faq->getId(),
$faq->getId(),
$faq->getNumAttachments());
if($thisstaff && $thisstaff->canManageFAQ()) {
$resp.=sprintf(' | <a href="faq.php?id=%d&a=edit">Edit</a>',$faq->getId());
$resp.=sprintf(' | <a href="faq.php?id=%d&a=edit">'.lang('edit').'</a>',$faq->getId());

}
$resp.='</div>';

return $resp;
return $resp;
}
}
?>
Loading