Skip to content

Commit

Permalink
Workaround for links from fb, like ?fbclid=x
Browse files Browse the repository at this point in the history
Now shows news page, instead of "not found".
For 0.9 there is better solution
  • Loading branch information
slawkens committed May 13, 2023
1 parent e081a67 commit 073d9da
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,24 @@
throw new RuntimeException('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!');
}

$isEmptyGet = false;
if (!empty($_GET)) {
foreach ($_GET as $value) {
if (empty($value)) {
$isEmptyGet = true;
}
}
}

$found = false;
if(empty($uri) || isset($_REQUEST['template'])) {
$_REQUEST['p'] = 'news';
if(empty($uri) || isset($_REQUEST['template']) || (!$isEmptyGet && !isset($_REQUEST['subtopic']) && !isset($_REQUEST['p']))) {
$_REQUEST['p'] = $_REQUEST['subtopic'] = 'news';
$found = true;
}
else {
$tmp = strtolower($uri);
if(!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(SYSTEM . 'pages/' . $tmp . '.php')) {
$_REQUEST['p'] = $uri;
$_REQUEST['p'] = $_REQUEST['subtopic'] = $uri;
$found = true;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion templates/kathrine/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function get_template_pages($category) {
}
else {
$tmp = URI;
if(empty($tmp)) {
if(empty($tmp) || !$isEmptyGet) {
$tmp = array('news');
}
else {
Expand Down

0 comments on commit 073d9da

Please sign in to comment.