mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 09:49:22 +02:00
* small fix related to warning about news
* fixed template path finding * fixed news adding when type != ARTICLE
This commit is contained in:
parent
4c6af13574
commit
603495ca97
@ -387,7 +387,7 @@ class News
|
||||
if(!self::verify($title, $body, $article_text, $article_image, $errors))
|
||||
return false;
|
||||
|
||||
$db->insert(TABLE_PREFIX . 'news', array('title' => $title, 'body' => $body, 'type' => $type, 'date' => time(), 'category' => $category, 'player_id' => isset($player_id) ? $player_id : 0, 'comments' => $comments, 'article_text' => $article_text, 'article_image' => $article_image));
|
||||
$db->insert(TABLE_PREFIX . 'news', array('title' => $title, 'body' => $body, 'type' => $type, 'date' => time(), 'category' => $category, 'player_id' => isset($player_id) ? $player_id : 0, 'comments' => $comments, 'article_text' => ($type == 3 ? $article_text : ''), 'article_image' => ($type == 3 ? $article_image : '')));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -15,42 +15,38 @@ if($config['template_allow_change'])
|
||||
{
|
||||
if(isset($_GET['template']))
|
||||
{
|
||||
$template_name = $_GET['template'];
|
||||
if(!preg_match("/[^A-z0-9_\-]/", $template_name)) { // validate template
|
||||
//setcookie('template', $template_name, 0, BASE_DIR . '/', $_SERVER["SERVER_NAME"]);
|
||||
$template_name = $_GET['template'];
|
||||
setSession('template', $template_name);
|
||||
header('Location:' . getSession('last_uri'));
|
||||
}
|
||||
else
|
||||
$template_name = $config['template'];
|
||||
}
|
||||
else {
|
||||
$template_session = getSession('template');
|
||||
if ($template_session !== false) {
|
||||
if (!preg_match("/[^A-z0-9_\-]/", $template_session)) {
|
||||
$template_name = $template_session;
|
||||
} else {
|
||||
$template_name = $config['template'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$template_path = 'templates/' . $template_name;
|
||||
|
||||
if(!file_exists($template_path . '/index.php') &&
|
||||
!file_exists($template_path . '/template.php') &&
|
||||
!file_exists($template_path . '/layout.php'))
|
||||
if(!file_exists(BASE . $template_path . '/index.php') &&
|
||||
!file_exists(BASE . $template_path . '/template.php') &&
|
||||
!file_exists(BASE . $template_path . '/layout.php'))
|
||||
{
|
||||
$template_name = 'kathrine';
|
||||
$template_path = TEMPLATES . $template_name;
|
||||
$template_path = 'templates/' . $template_name;
|
||||
}
|
||||
|
||||
$file = $template_path . '/config.ini';
|
||||
$file = BASE . $template_path . '/config.ini';
|
||||
$exists = file_exists($file);
|
||||
if($exists || ($config['backward_support'] && file_exists($template_path . '/layout_config.ini')))
|
||||
if($exists || ($config['backward_support'] && file_exists(BASE . $template_path . '/layout_config.ini')))
|
||||
{
|
||||
if(!$exists)
|
||||
$file = $template_path . '/layout_config.ini';
|
||||
$file = BASE . $template_path . '/layout_config.ini';
|
||||
|
||||
if($cache->enabled())
|
||||
{
|
||||
@ -69,8 +65,8 @@ if($exists || ($config['backward_support'] && file_exists($template_path . '/lay
|
||||
foreach($template_ini as $key => $value)
|
||||
$config[$key] = $value;
|
||||
}
|
||||
else if(file_exists($template_path . '/config.php'))
|
||||
require($template_path . '/config.php');
|
||||
else if(file_exists(BASE . $template_path . '/config.php'))
|
||||
require(BASE . $template_path . '/config.php');
|
||||
|
||||
$template = array();
|
||||
$template['link_account_manage'] = getLink('account/manage');
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% if action != 'edit' %}
|
||||
<a id="news-button" href="#">Add news</a>
|
||||
{% endif %}
|
||||
<form method="post" action="{{ news_link_form }}">
|
||||
<form method="post" action="{{ news_link_form }}" id="news-edit-form">
|
||||
{% if action == 'edit' %}
|
||||
<input type="hidden" name="id" value="{{ news_id }}" />
|
||||
{% endif %}
|
||||
@ -171,6 +171,10 @@
|
||||
window.location = '{{ news_link }}';
|
||||
});
|
||||
|
||||
$("#news-edit-form").submit(function( event ) {
|
||||
unsaved = false;
|
||||
});
|
||||
|
||||
lastContent = $("#body").val();
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user