Skip to content

Commit ded7bb9

Browse files
committed
Fixed some bugs
1 parent f642a1f commit ded7bb9

5 files changed

Lines changed: 26 additions & 26 deletions

File tree

inc/conf.const.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
define('DATA_PATH', ROOT_PATH . 'data/');
2323

2424
define('ROOT_URL', PROT_URL . $_SERVER['HTTP_HOST'] . SELF);
25-
define('STATIC_URL', ROOT_URL . 'static/');
25+
define('STATIC_URL', RELATIVE . 'static/');

inc/scripts/fns.html.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function get_links_html() {
2222
$sLink = htmlentities(str_replace(array('.tpl', DATA_PATH, LANG . '/'), '', $sLink));
2323
$sName = ucfirst(str_replace(array('/', '-'), array('', ' '), $sLink));
2424

25-
$sHtml .= '<li>' . $i++ . ') <a href="' . ROOT_URL . LANG . '/' . $sLink . '" title="' . $sName . '">' . $sName . '</a>.</li>';
25+
$sHtml .= '<li>' . $i++ . ') <a href="' . RELATIVE . LANG . '/' . $sLink . '" title="' . $sName . '" data-load="ajax">' . $sName . '</a>.</li>';
2626
}
2727

2828
$sHtml .= '</ul>';
@@ -41,7 +41,7 @@ function get_langs_html() {
4141

4242
foreach ($aLangs as $sLang) {
4343
if($sLang === LANG) continue;
44-
$sHtml .= '<a href="' . ROOT_URL . substr($sLang,0,2) . '"><img src="' . STATIC_URL . 'img/flags/' . $sLang . '.gif" alt="' . $aLangsList[$sLang] . '" title="' . $aLangsList[$sLang] . '" /></a>';
44+
$sHtml .= '<a href="' . RELATIVE . substr($sLang,0,2) . '" data-load="ajax"><img src="' . STATIC_URL . 'img/flags/' . $sLang . '.gif" alt="' . $aLangsList[$sLang] . '" title="' . $aLangsList[$sLang] . '" /></a>&nbsp;';
4545
}
4646

4747
return $sHtml;

inc/scripts/fns.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* @return string The first two lowercase letter of the browser language.
1515
*/
1616
function get_browser_lang() {
17-
$lang = explode(',' ,@$_SERVER['HTTP_ACCEPT_LANGUAGE']);
18-
return htmlspecialchars(strtolower(substr(chop($lang[0]), 0, 2)));
17+
$lang = explode(',' ,@$_SERVER['HTTP_ACCEPT_LANGUAGE']);
18+
return htmlspecialchars(strtolower(substr(chop($lang[0]), 0, 2)));
1919
}
2020

2121
/**
@@ -41,7 +41,7 @@ function get_page($sPage) {
4141
* @return string The text parsed.
4242
*/
4343
function parse_var($sContent) {
44-
$sContent = str_replace('{site_url}', ROOT_URL, $sContent);
44+
$sContent = str_replace('{site_url}', RELATIVE, $sContent);
4545
$sContent = str_replace('{static_url}', STATIC_URL, $sContent);
4646
$sContent = str_replace('{tpl_name}', TPL, $sContent);
4747
$sContent = str_replace('{menu_links}', get_links_html(), $sContent);
@@ -90,25 +90,25 @@ function get_current_url() {
9090
* @return string The language available.
9191
*/
9292
function set_lang() {
93-
if(!empty($_GET['l']) && is_file(DATA_PATH . $_GET['l'] . '/core/welcome.tpl') && is_file(DATA_PATH . $_GET['l'] . '/core/404-error.tpl'))
94-
{
95-
setcookie('pH7_doc_lang', $_GET['l'], time()+60*60*24*365, null, null, false, true);
96-
$sLang = $_GET['l'];
97-
}
98-
elseif (isset($_COOKIE['pH7_doc_lang']) && is_dir(DATA_PATH . $_COOKIE['pH7_doc_lang'] . '/core/'))
99-
{
100-
$sLang = $_COOKIE['pH7_doc_lang'];
101-
}
102-
elseif(is_dir(DATA_PATH . get_browser_lang() . '/core/'))
103-
{
104-
$sLang = get_browser_lang();
105-
}
106-
else
107-
{
108-
$sLang = DEF_LANG;
109-
}
93+
if(!empty($_GET['l']) && is_file(DATA_PATH . $_GET['l'] . '/core/welcome.tpl') && is_file(DATA_PATH . $_GET['l'] . '/core/404-error.tpl'))
94+
{
95+
setcookie('pH7_doc_lang', $_GET['l'], time()+60*60*24*365, null, null, false, true);
96+
$sLang = $_GET['l'];
97+
}
98+
elseif (isset($_COOKIE['pH7_doc_lang']) && is_dir(DATA_PATH . $_COOKIE['pH7_doc_lang'] . '/core/'))
99+
{
100+
$sLang = $_COOKIE['pH7_doc_lang'];
101+
}
102+
elseif(is_dir(DATA_PATH . get_browser_lang() . '/core/'))
103+
{
104+
$sLang = get_browser_lang();
105+
}
106+
else
107+
{
108+
$sLang = DEF_LANG;
109+
}
110110

111-
return $sLang;
111+
return $sLang;
112112
}
113113

114114
/**

static/js/ajph.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $(document).ready(function() {
1919
});
2020

2121
function doPager() {
22-
$('article a, footer a, a#logo').click(function(e) {
22+
$('a[data-load=ajax]').click(function(e) {
2323
e.preventDefault();
2424
$('#ajph').html("<div id='loading'>Loading...</div>");
2525
loadPage($(this).attr('href'));

themes/base/tpl/header.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<div class="center" id="block">
1212

1313
<header>
14-
<h1><a id="logo" href="{site_url}">pH</a></h1>
14+
<h1><a id="logo" href="{site_url}" data-load="ajax">pH</a></h1>
1515
</header>
1616

1717
<div id="ajph">

0 commit comments

Comments
 (0)