mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 17:54:55 +02:00
Made so it's possible to configure more directories as constants
More flexibility for the user.
This commit is contained in:
@@ -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>
|
||||
|
Reference in New Issue
Block a user