-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
80 lines (69 loc) · 3.18 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'index');
// ######################### REQUIRE BACK-END ############################
require_once( realpath('include/global.php') );
// ########################### INIT VARIABLES ############################
$navigation = '';
$content = '';
// ########################### IDENTIFY USER #############################
loggedInOrReturn();
setDefaultForLoggedinUser();
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
$website -> input -> clean_array_gpc('g', array('action' => TYPE_NOHTML));
if ( isset($website -> GPC['action']) ) {
if ( empty($website -> GPC['action']) OR !strlen($website -> GPC['action']) ) {
$info = new Xliff_Information();
$content = $info -> getGlobalTranslationStatus();
}
elseif ( $website -> GPC['action'] == 'status' ) {
$info = new Xliff_Information();
// selected langaues from current user
$content = $info -> getCurrentTranslationStatus(true);
// languages not selected by the current user
$content .= $info -> getCurrentTranslationStatus(false);
}
elseif ( $website -> GPC['action'] == 'translate' ) {
$form = new Translation();
$content = $form -> getAjaxTranslationForm();
}
elseif ( $website -> GPC['action'] == 'details' ) {
$langs = new Languages();
$list = $langs -> getLanguageByID();
$info = new Xliff_Information();
$filter = $info -> getLanguagesFromCurrentUser();
$options = array();
$options[] = '<option value="-1">' . $website -> user_lang['global']['option_actions_select'] . '</option>';
foreach( $list AS $langID => $langCode ) {
if ( $langCode != 'ru' ) {
if ( $website -> userinfo['admin'] == 'yes' OR (is_array($filter) AND in_array($langCode, $filter) ) ) {
$options[] = '<option value="' . $langID . '">' . $website -> user_lang['languages'][$langCode] . '</option>';
}
}
}
$renderer -> loadTemplate('details' . DS . 'overview.htm');
$renderer -> setVariable('select_options', implode("\n ", $options));
$content = $renderer -> renderTemplate();
}
elseif ( $website -> GPC['action'] == 'history' ) {
$history = new Translation_History();
$content = $history -> getHistoryTable();
}
elseif ( $website -> GPC['action'] == 'search' ) {
$search = new Xliff_Information();
$content = $search -> getSearchForm();
}
else {
$content = $website -> user_lang['global']['unkonwn_action'];
}
}
else {
$content = $website -> user_lang['global']['unkonwn_action'];
}
$renderer -> loadTemplate(THIS_SCRIPT . '.htm');
$renderer -> addCustonStyle(array('script' => 'skin/css/index.css'), THIS_SCRIPT);
$renderer -> setVariable('global_navbar', $navigation);
$renderer -> setVariable(THIS_SCRIPT . '_content', $content);
print_output($renderer -> renderTemplate());