mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 09:19:22 +02:00
Made so it's possible to configure more directories as constants
More flexibility for the user.
This commit is contained in:
parent
708aa2d72f
commit
74d013049d
8
.gitignore
vendored
8
.gitignore
vendored
@ -24,6 +24,10 @@ templates/*
|
||||
images/guilds/*
|
||||
!images/guilds/default.gif
|
||||
|
||||
# editor images
|
||||
images/editor/*
|
||||
!images/editor/index.html
|
||||
|
||||
# cache
|
||||
system/cache/*
|
||||
!system/cache/index.html
|
||||
@ -54,9 +58,5 @@ landing
|
||||
# system
|
||||
system/functions_custom.php
|
||||
|
||||
# user data
|
||||
user/*
|
||||
!user/index.html
|
||||
|
||||
# others/rest
|
||||
system/pages/downloads.php
|
||||
|
@ -15,7 +15,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
|
||||
return;
|
||||
}
|
||||
|
||||
$imageFolder = BASE . 'images/editor';
|
||||
$imageFolder = BASE . EDITOR_IMAGES_DIR;
|
||||
|
||||
reset ($_FILES);
|
||||
$temp = current($_FILES);
|
||||
@ -43,7 +43,7 @@ if (is_uploaded_file($temp['tmp_name'])) {
|
||||
|
||||
move_uploaded_file($temp['tmp_name'], $fileToWrite);
|
||||
|
||||
$returnPathToImage = BASE_URL . 'images/editor/' . $randomName;
|
||||
$returnPathToImage = BASE_URL . EDITOR_IMAGES_DIR . $randomName;
|
||||
echo json_encode(['location' => $returnPathToImage]);
|
||||
} else {
|
||||
// Notify editor that the upload failed
|
||||
|
@ -68,6 +68,12 @@ const TEMPLATES = BASE . 'templates/';
|
||||
const TOOLS = BASE . 'tools/';
|
||||
const VENDOR = BASE . 'vendor/';
|
||||
|
||||
// other dirs
|
||||
const SESSIONS_DIR = SYSTEM . 'php_sessions';
|
||||
const GUILD_IMAGES_DIR = 'user_images/';
|
||||
const EDITOR_IMAGES_DIR = 'images/editor/';
|
||||
const GALLERY_DIR = 'images/gallery/';
|
||||
|
||||
// menu categories
|
||||
const MENU_CATEGORY_NEWS = 1;
|
||||
const MENU_CATEGORY_ACCOUNT = 2;
|
||||
@ -89,7 +95,7 @@ const TFS_LAST = TFS_03;
|
||||
// other definitions
|
||||
const ACCOUNT_NUMBER_LENGTH = 8;
|
||||
|
||||
session_save_path(SYSTEM . 'php_sessions');
|
||||
session_save_path(SESSIONS_DIR);
|
||||
session_start();
|
||||
|
||||
// basedir
|
||||
|
@ -7,8 +7,8 @@ $dirs_required = [
|
||||
'system/cache',
|
||||
];
|
||||
$dirs_optional = [
|
||||
'images/guilds' => $locale['step_requirements_warning_images_guilds'],
|
||||
'images/gallery' => $locale['step_requirements_warning_images_gallery'],
|
||||
GUILD_IMAGES_DIR => $locale['step_requirements_warning_images_guilds'],
|
||||
GALLERY_DIR => $locale['step_requirements_warning_images_gallery'],
|
||||
];
|
||||
|
||||
$extensions_required = [
|
||||
|
@ -3,12 +3,12 @@
|
||||
$db->query("RENAME TABLE
|
||||
" . TABLE_PREFIX . "screenshots TO " . TABLE_PREFIX . "gallery,
|
||||
" . TABLE_PREFIX . "movies TO " . TABLE_PREFIX . "videos;");
|
||||
|
||||
|
||||
// rename images dir
|
||||
if(file_exists(BASE . 'images/screenshots') && !file_exists(BASE .'images/gallery')) {
|
||||
rename(BASE . 'images/screenshots', BASE . 'images/gallery');
|
||||
if(file_exists(BASE . 'images/screenshots') && !file_exists(BASE . GALLERY_DIR)) {
|
||||
rename(BASE . 'images/screenshots', BASE . GALLERY_DIR);
|
||||
}
|
||||
|
||||
|
||||
// convert old database screenshots images to gallery
|
||||
$query = $db->query('SELECT `id`, `image`, `thumb` FROM `' . TABLE_PREFIX . 'gallery`;');
|
||||
foreach($query->fetchAll() as $item) {
|
||||
@ -17,4 +17,4 @@
|
||||
'thumb' => str_replace('/screenshots/', '/gallery/', $item['thumb']),
|
||||
), array('id' => $item['id']));
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@ -145,8 +145,8 @@ class Gallery
|
||||
|
||||
$pathinfo = pathinfo($image);
|
||||
$extension = strtolower($pathinfo['extension']);
|
||||
$thumb_filename = 'images/gallery/' . $pathinfo['filename'] . '_thumb.' . $extension;
|
||||
$filename = 'images/gallery/' . $pathinfo['filename'] . '.' . $extension;
|
||||
$thumb_filename = GALLERY_DIR . $pathinfo['filename'] . '_thumb.' . $extension;
|
||||
$filename = GALLERY_DIR . $pathinfo['filename'] . '.' . $extension;
|
||||
if($db->insert(TABLE_PREFIX . 'gallery', array(
|
||||
'comment' => $comment,
|
||||
'image' => $filename, 'author' => $author,
|
||||
@ -172,7 +172,7 @@ class Gallery
|
||||
|
||||
$pathinfo = pathinfo($image);
|
||||
$extension = strtolower($pathinfo['extension']);
|
||||
$filename = 'images/gallery/' . $pathinfo['filename'] . '.' . $extension;
|
||||
$filename = GALLERY_DIR . $pathinfo['filename'] . '.' . $extension;
|
||||
|
||||
if($db->update(TABLE_PREFIX . 'gallery', array(
|
||||
'comment' => $comment,
|
||||
@ -291,7 +291,7 @@ class Gallery
|
||||
{
|
||||
$pathinfo = pathinfo($file);
|
||||
$extension = strtolower($pathinfo['extension']);
|
||||
$thumb_filename = 'images/gallery/' . $pathinfo['filename'] . '_thumb.' . $extension;
|
||||
$thumb_filename = GALLERY_DIR . $pathinfo['filename'] . '_thumb.' . $extension;
|
||||
|
||||
if(!self::resize($file, 170, 110, $thumb_filename, $errors))
|
||||
return false;
|
||||
|
@ -44,7 +44,7 @@ if(empty($errors)) {
|
||||
$allowed_ext = array('image/gif', 'image/jpg', 'image/pjpeg', 'image/jpeg', 'image/bmp', 'image/png', 'image/x-png');
|
||||
$ext_name = array('image/gif' => 'gif', 'image/jpg' => 'jpg', 'image/jpeg' => 'jpg', 'image/pjpeg' => 'jpg', 'image/bmp' => 'bmp', 'image/png' => 'png', 'image/x-png' => 'png');
|
||||
$save_file_name = str_replace(' ', '_', strtolower($guild->getName()));
|
||||
$save_path = 'images/guilds/' . $save_file_name;
|
||||
$save_path = GUILD_IMAGES_DIR . $save_file_name;
|
||||
if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save')
|
||||
{
|
||||
$file = $_FILES['newlogo'];
|
||||
@ -74,12 +74,12 @@ if(empty($errors)) {
|
||||
{
|
||||
$guild_logo = $guild->getCustomField('logo_name');
|
||||
$guild_logo = str_replace(array('..', '/', '\\'), array('','',''), $guild->getCustomField('logo_name'));
|
||||
if(empty($guild_logo) || !file_exists('images/guilds/' . $guild_logo)) {
|
||||
if(empty($guild_logo) || !file_exists(GUILD_IMAGES_DIR . $guild_logo)) {
|
||||
$guild_logo = "default.gif";
|
||||
}
|
||||
|
||||
if($guild_logo != "default.gif" && $guild_logo != $save_file_name.'.'.$extension) {
|
||||
unlink('images/guilds/' . $guild_logo);
|
||||
unlink(GUILD_IMAGES_DIR . $guild_logo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ if(empty($errors)) {
|
||||
}
|
||||
|
||||
$guild_logo = $guild->getCustomField('logo_name');
|
||||
if(empty($guild_logo) || !file_exists('images/guilds/' . $guild_logo)) {
|
||||
if(empty($guild_logo) || !file_exists(GUILD_IMAGES_DIR . $guild_logo)) {
|
||||
$guild_logo = "default.gif";
|
||||
}
|
||||
|
||||
@ -122,4 +122,4 @@ if(!empty($errors)) {
|
||||
'action' => '?subtopic=guilds'
|
||||
));
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@ -19,7 +19,7 @@ if(count($guilds_list) > 0)
|
||||
{
|
||||
foreach ($guilds_list as $guild) {
|
||||
$guild_logo = $guild->getCustomField('logo_name');
|
||||
if (empty($guild_logo) || !file_exists('images/guilds/' . $guild_logo))
|
||||
if (empty($guild_logo) || !file_exists(GUILD_IMAGES_DIR . $guild_logo))
|
||||
$guild_logo = "default.gif";
|
||||
|
||||
$description = $guild->getCustomField('description');
|
||||
@ -36,4 +36,4 @@ $twig->display('guilds.list.html.twig', array(
|
||||
'guilds' => $guilds,
|
||||
'logged' => isset($logged) ? $logged : false,
|
||||
'isAdmin' => admin(),
|
||||
));
|
||||
));
|
||||
|
@ -77,7 +77,7 @@ if($logged)
|
||||
|
||||
//show guild page
|
||||
$guild_logo = $guild->getCustomField('logo_name');
|
||||
if(empty($guild_logo) || !file_exists('images/guilds/' . $guild_logo))
|
||||
if(empty($guild_logo) || !file_exists(GUILD_IMAGES_DIR . $guild_logo))
|
||||
$guild_logo = "default.gif";
|
||||
|
||||
$description = $guild->getCustomField('description');
|
||||
@ -159,4 +159,4 @@ $twig->display('guilds.view.html.twig', array(
|
||||
'invited_list' => $invited_list,
|
||||
'show_accept_invite' => $show_accept_invite,
|
||||
'useGuildNick' => $useGuildNick
|
||||
));
|
||||
));
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div style="text-align:center"><h2>Change guild logo</h2></div>
|
||||
Here you can change logo of your guild.<br/>Actuall logo: <img src="images/guilds/{{ guild_logo }}" height="64" width="64"><br/><br/>
|
||||
Here you can change logo of your guild.<br/>Actuall logo: <img src="{{ constant('GUILD_IMAGES_DIR') }}{{ guild_logo }}" height="64" width="64"><br/><br/>
|
||||
<form enctype="multipart/form-data" action="?subtopic=guilds&guild={{ guild.getName() }}&action=change_logo" method="post" id="upload_form">
|
||||
<input type="hidden" name="todo" value="save" />
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="{{ max_image_size_b }}" />
|
||||
|
@ -41,7 +41,7 @@
|
||||
{% set i = i + 1 %}
|
||||
<tr bgcolor="{{ getStyle(i) }}">
|
||||
<td>
|
||||
<img src="images/guilds/{{ guild.logo }}" width="64" height="64">
|
||||
<img src="{{ constant('GUILD_IMAGES_DIR') }}{{ guild.logo }}" width="64" height="64">
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
@ -5,13 +5,13 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="64">
|
||||
<img src="images/guilds/{{ logo }}" width="64" height="64">
|
||||
<img src="{{ constant('GUILD_IMAGES_DIR') }}{{ logo }}" width="64" height="64">
|
||||
</td>
|
||||
|
||||
<td align="center" width="100%"><h1>{{ guild_name }}</h1></td>
|
||||
|
||||
<td width="64">
|
||||
<img src="images/guilds/{{ logo }}" width="64" height="64">
|
||||
<img src="{{ constant('GUILD_IMAGES_DIR') }}{{ logo }}" width="64" height="64">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
Loading…
x
Reference in New Issue
Block a user