aboutsummaryrefslogtreecommitdiffstats
path: root/langs.php
blob: 0cd37fed70d903345df5567c59479bead9fbc0ab (plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php
/**
*/

if (isset($_SERVER['APP_MODE']) && $_SERVER['APP_MODE'] !== 'prod') {
    ini_set('error_reporting', E_ALL);
    ini_set('show_errors', true);
    ini_set('display_errors', true);
} else {
    ini_set('error_reporting', FALSE);
    ini_set('show_errors', FALSE);
    ini_set('display_errors', FALSE);
    ini_set('log_errors', FALSE);
}

if ($_SERVER['HTTP_HOST'] == 'www-test.mageia.org') {
    ini_set('error_reporting', E_ALL&~E_DEPRECATED);
    ini_set('show_errors', true);
    ini_set('display_errors', true);
    ini_set('log_errors', true);
}

//$g_app_root = realpath(dirname(__FILE__));
//define('G_APP_ROOT', $g_app_root);

// $g_donate_amount = '--';
// $g_amount_remain = 'EUR&nbsp;10,244.46';

$G_coord_assos = <<<T
  Association Mageia.Org
  6 rue du chateau d'eau
  78650 BEYNES
  FRANCE
T;
$G_coord_assos_bank = <<<T
  CIC BEYNES
  18 rue de la République
  78650 BEYNES
  FRANCE

  IBAN:
  BIC:
T;

//Removed temporarily, something fishy with the account to check
//IBAN: FR76 3006 6103 1600 0202 1370 139
//BIC:  CMCIFRPP

require_once 'langs.inc.php';

$sru = trim($_SERVER['REQUEST_URI']);
$sel = explode('/', $sru);
array_shift($sel);
if (!isset($locale))
    $locale = array_shift($sel);

$page       = count($sel) > 0 ? implode('/', $sel) : null;
$list_langs = array();
$options    = array();

foreach ($langs as $k => $v) {
    $list_langs[] = sprintf('<a href="/%s"%s>%s</a>',
        $page != null ? implode('/', array($k, $page)) : $k,
        $k == $locale ? ' class="sel"' : '',
        $v);

    $options[] = sprintf('<option value="%s"%s>%s</option>',
        $k,
        $k == $locale ? ' selected="selected"' : '',
        $v);
        $k == $locale ? $fullCurrentLang = $v: '';
}

$options = implode($options);
$langsForm = <<<H
</ul><ul class="navbar-nav"><li class="nav-item"><a class="nav-link globe-icon" href="#langsModal" data-toggle="modal" data-target="#langsModal">{$fullCurrentLang}</a></li>
H;

$langsModal = <<<H
<div class="modal fade" id="langsModal">
   <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        </div>
       <div class="modal-body">
            <form class="form-group" id="lang_form" dir="ltr" method="get" action="/">
            <input class="form-control" type="hidden" name="furl" value="{$_SERVER['REQUEST_URI']}" />
                <select class="form-control custom-select" id="flang" name="flang" dir="ltr" onchange="this.form.submit()">
                {$options}
                </select>
            <noscript><div><input type="submit" id="lang_submit" value="Hop!" /></div></noscript>
            </form>
        </div>
      </div>
    </div>
</div> <!--end modal -->
H;

// _mgnav_style() no more needed
$hsnav = _mgnav_html(true, $locale, $langsForm, $_SERVER['HTTP_HOST']). $langsModal;
$hsfoot = '';

if (!defined('HLANG'))
    echo $hsnav;

function common_header(){
    $common_header = '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . PHP_EOL;
    $common_header .= '    <link rel="stylesheet" href="/g/style/bootstrap.min.css">' . PHP_EOL;
    $common_header .= '    <link rel="stylesheet" href="/g/style/bootstrap_theme.css">' . PHP_EOL;
    $common_header .= '    <link rel="stylesheet" href="/g/style/common_footer.css">' . PHP_EOL;
    return $common_header;
}

/**
    * Output common footer in passed language
    *
    * @param string $locale
    *
    * @return string $common_footer
*/
function common_footer($locale = 'en')
{
    $nav = array(
        'nav-support'    => array('/support/',    _r('Support')),
        'nav-community'  => array('/community/',  _r('Community')),
        'nav-about'      => array('/about/',      _r('About&nbsp;Mageia.Org'))
    );

    $common_footer  = '<hr class="divider">' . PHP_EOL;
    $common_footer .= '<div id="down">' . PHP_EOL;
    $common_footer .= '    <div class="container">' . PHP_EOL;
    $common_footer .= '        <ul id="navb">';
    foreach ($nav as $k => $v) {
            $common_footer .= sprintf(
                '<li><a class="%s" href="%s">%s</a></li>',
                $k, $v[0], $v[1]
            );
    }
    $common_footer .= '</ul>' . PHP_EOL;
    $common_footer .= '        <hr class="divider">' . PHP_EOL;
    $common_footer .= '        <p id="fnotes">' . PHP_EOL;
    $common_footer .= "            <a href=\"/$locale/map/\">" . _r('Sitemap') . '</a>' . PHP_EOL;
    $common_footer .= "            | <a href=\"/$locale/about/policies/privacy/\">";
    $common_footer .= _r('Privacy policy') . '</a>' . PHP_EOL;
    $common_footer .= '        </p>' . PHP_EOL;
    $common_footer .= '    </div>' . PHP_EOL;
    $common_footer .= '</div>' . PHP_EOL;
    $common_footer .= '<script src="/g/js/jquery-3.2.1.min.js"></script>' . PHP_EOL;
    $common_footer .= '<script src="/g/js/tether.min.js"></script>' . PHP_EOL;
    $common_footer .= '<script src="/g/js/bootstrap.min.js"></script>' . PHP_EOL;

    return $common_footer;
}