mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 09:19:22 +02:00
* renamed screenshots to gallery and movies to videos
This commit is contained in:
parent
3fef1a6eec
commit
dd572b00d0
@ -27,7 +27,7 @@ Official website: https://my-aac.org
|
|||||||
chmod 660 config.local.php
|
chmod 660 config.local.php
|
||||||
chmod 660 images/guilds
|
chmod 660 images/guilds
|
||||||
chmod 660 images/houses
|
chmod 660 images/houses
|
||||||
chmod 660 images/screenshots
|
chmod 660 images/gallery
|
||||||
|
|
||||||
Visit http://your_domain/install (http://localhost/install) and follow instructions in the browser.
|
Visit http://your_domain/install (http://localhost/install) and follow instructions in the browser.
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ session_start();
|
|||||||
|
|
||||||
define('MYAAC', true);
|
define('MYAAC', true);
|
||||||
define('MYAAC_VERSION', '0.5.1');
|
define('MYAAC_VERSION', '0.5.1');
|
||||||
define('DATABASE_VERSION', 10);
|
define('DATABASE_VERSION', 11);
|
||||||
define('TABLE_PREFIX', 'myaac_');
|
define('TABLE_PREFIX', 'myaac_');
|
||||||
define('START_TIME', microtime(true));
|
define('START_TIME', microtime(true));
|
||||||
define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : (strtoupper(PHP_OS) == 'DARWIN' ? 'MAC' : 'LINUX'));
|
define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : (strtoupper(PHP_OS) == 'DARWIN' ? 'MAC' : 'LINUX'));
|
||||||
@ -43,8 +43,8 @@ define('FLAG_CONTENT_FORUM', 32);
|
|||||||
define('FLAG_CONTENT_COMMANDS', 64);
|
define('FLAG_CONTENT_COMMANDS', 64);
|
||||||
define('FLAG_CONTENT_SPELLS', 128);
|
define('FLAG_CONTENT_SPELLS', 128);
|
||||||
define('FLAG_CONTENT_MONSTERS', 256);
|
define('FLAG_CONTENT_MONSTERS', 256);
|
||||||
define('FLAG_CONTENT_SCREENSHOTS', 512);
|
define('FLAG_CONTENT_GALLERY', 512);
|
||||||
define('FLAG_CONTENT_MOVIES', 1024);
|
define('FLAG_CONTENT_VIDEOS', 1024);
|
||||||
define('FLAG_CONTENT_FAQ', 2048);
|
define('FLAG_CONTENT_FAQ', 2048);
|
||||||
|
|
||||||
// news
|
// news
|
||||||
|
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 122 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@ -147,7 +147,7 @@ CREATE TABLE `myaac_monsters` (
|
|||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE = MyISAM;
|
) ENGINE = MyISAM;
|
||||||
|
|
||||||
CREATE TABLE `myaac_movies`
|
CREATE TABLE `myaac_videos`
|
||||||
(
|
(
|
||||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
`title` VARCHAR(100) NOT NULL DEFAULT '',
|
`title` VARCHAR(100) NOT NULL DEFAULT '',
|
||||||
@ -214,7 +214,7 @@ CREATE TABLE `myaac_pages`
|
|||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE = MyISAM;
|
) ENGINE = MyISAM;
|
||||||
|
|
||||||
CREATE TABLE `myaac_screenshots`
|
CREATE TABLE `myaac_gallery`
|
||||||
(
|
(
|
||||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
`comment` VARCHAR(255) NOT NULL DEFAULT '',
|
`comment` VARCHAR(255) NOT NULL DEFAULT '',
|
||||||
@ -226,7 +226,7 @@ CREATE TABLE `myaac_screenshots`
|
|||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE = MyISAM;
|
) ENGINE = MyISAM;
|
||||||
|
|
||||||
INSERT INTO `myaac_screenshots` (`id`, `ordering`, `comment`, `image`, `thumb`, `author`) VALUES (NULL, 1, 'Demon', 'images/screenshots/demon.jpg', 'images/screenshots/demon_thumb.gif', 'MyAAC');
|
INSERT INTO `myaac_gallery` (`id`, `ordering`, `comment`, `image`, `thumb`, `author`) VALUES (NULL, 1, 'Demon', 'images/gallery/demon.jpg', 'images/gallery/demon_thumb.gif', 'MyAAC');
|
||||||
|
|
||||||
CREATE TABLE `myaac_spells`
|
CREATE TABLE `myaac_spells`
|
||||||
(
|
(
|
||||||
|
@ -23,7 +23,7 @@ $failed = false;
|
|||||||
|
|
||||||
// start validating
|
// start validating
|
||||||
version_check($locale['step_requirements_php_version'], (PHP_VERSION_ID >= 50200), PHP_VERSION);
|
version_check($locale['step_requirements_php_version'], (PHP_VERSION_ID >= 50200), PHP_VERSION);
|
||||||
foreach(array('config.local.php', 'images/guilds', 'images/houses', 'images/screenshots') as $value)
|
foreach(array('config.local.php', 'images/guilds', 'images/houses', 'images/gallery') as $value)
|
||||||
{
|
{
|
||||||
$perms = (int) substr(decoct(fileperms(BASE . $value)), 2);
|
$perms = (int) substr(decoct(fileperms(BASE . $value)), 2);
|
||||||
version_check($locale['step_requirements_write_perms'] . ': ' . $value, $perms >= 660);
|
version_check($locale['step_requirements_write_perms'] . ': ' . $value, $perms >= 660);
|
||||||
|
20
system/migrations/11.php
Normal file
20
system/migrations/11.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
// rename database tables
|
||||||
|
$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');
|
||||||
|
}
|
||||||
|
|
||||||
|
// convert old database screenshots images to gallery
|
||||||
|
$query = $db->query('SELECT `id`, `image`, `thumb` FROM `' . TABLE_PREFIX . 'gallery`;');
|
||||||
|
foreach($query->fetchAll() as $item) {
|
||||||
|
$db->update(TABLE_PREFIX . 'gallery', array(
|
||||||
|
'image' => str_replace('/screenshots/', '/gallery/', $item['image']),
|
||||||
|
'thumb' => str_replace('/screenshots/', '/gallery/', $item['thumb']),
|
||||||
|
), array('id' => $item['id']));
|
||||||
|
}
|
||||||
|
?>
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Screenshots
|
* Gallery
|
||||||
*
|
*
|
||||||
* @package MyAAC
|
* @package MyAAC
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
@ -9,9 +9,9 @@
|
|||||||
* @link http://my-aac.org
|
* @link http://my-aac.org
|
||||||
*/
|
*/
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
$title = 'Screenshots';
|
$title = 'Gallery';
|
||||||
|
|
||||||
$canEdit = hasFlag(FLAG_CONTENT_SCREENSHOTS) || superAdmin();
|
$canEdit = hasFlag(FLAG_CONTENT_GALLERY) || superAdmin();
|
||||||
if($canEdit) {
|
if($canEdit) {
|
||||||
if(function_exists('imagecreatefrompng')) {
|
if(function_exists('imagecreatefrompng')) {
|
||||||
if (!empty($action)) {
|
if (!empty($action)) {
|
||||||
@ -30,34 +30,34 @@ if($canEdit) {
|
|||||||
$errors = array();
|
$errors = array();
|
||||||
|
|
||||||
if ($action == 'add') {
|
if ($action == 'add') {
|
||||||
if (Screenshots::add($comment, $image, $author, $errors))
|
if (Gallery::add($comment, $image, $author, $errors))
|
||||||
$comment = $image = $author = '';
|
$comment = $image = $author = '';
|
||||||
} else if ($action == 'delete') {
|
} else if ($action == 'delete') {
|
||||||
Screenshots::delete($id, $errors);
|
Gallery::delete($id, $errors);
|
||||||
} else if ($action == 'edit') {
|
} else if ($action == 'edit') {
|
||||||
if (isset($id) && !isset($name)) {
|
if (isset($id) && !isset($name)) {
|
||||||
$screenshot = Screenshots::get($id);
|
$tmp = Gallery::get($id);
|
||||||
$comment = $screenshot['comment'];
|
$comment = $tmp['comment'];
|
||||||
$image = $screenshot['image'];
|
$image = $tmp['image'];
|
||||||
$author = $screenshot['author'];
|
$author = $tmp['author'];
|
||||||
} else {
|
} else {
|
||||||
Screenshots::update($id, $comment, $image, $author);
|
Gallery::update($id, $comment, $image, $author);
|
||||||
$action = $comment = $image = $author = '';
|
$action = $comment = $image = $author = '';
|
||||||
}
|
}
|
||||||
} else if ($action == 'hide') {
|
} else if ($action == 'hide') {
|
||||||
Screenshots::toggleHidden($id, $errors);
|
Gallery::toggleHidden($id, $errors);
|
||||||
} else if ($action == 'moveup') {
|
} else if ($action == 'moveup') {
|
||||||
Screenshots::move($id, -1, $errors);
|
Gallery::move($id, -1, $errors);
|
||||||
} else if ($action == 'movedown') {
|
} else if ($action == 'movedown') {
|
||||||
Screenshots::move($id, 1, $errors);
|
Gallery::move($id, 1, $errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($errors))
|
if (!empty($errors))
|
||||||
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
echo $twig->render('error_box.html.twig', array('errors' => $errors));
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $twig->render('screenshots.form.html.twig', array(
|
echo $twig->render('gallery.form.html.twig', array(
|
||||||
'link' => getLink('screenshots/' . ($action == 'edit' ? 'edit' : 'add')),
|
'link' => getLink('gallery/' . ($action == 'edit' ? 'edit' : 'add')),
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
'id' => isset($id) ? $id : null,
|
'id' => isset($id) ? $id : null,
|
||||||
'comment' => isset($comment) ? $comment : null,
|
'comment' => isset($comment) ? $comment : null,
|
||||||
@ -66,63 +66,63 @@ if($canEdit) {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
echo 'You cannot edit/add screenshots as it seems your PHP installation doesnt have GD support enabled. Visit <a href="http://be2.php.net/manual/en/image.installation.php">PHP Manual</a> for more info.';
|
echo 'You cannot edit/add gallery items as it seems your PHP installation doesnt have GD support enabled. Visit <a href="http://be2.php.net/manual/en/image.installation.php">PHP Manual</a> for more info.';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_GET['screenshot']))
|
if(isset($_GET['image']))
|
||||||
{
|
{
|
||||||
$screenshot = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'screenshots` WHERE `id` = ' . $db->quote($_GET['screenshot']) . ' ORDER by `ordering` LIMIT 1;');
|
$image = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'gallery` WHERE `id` = ' . $db->quote($_GET['image']) . ' ORDER by `ordering` LIMIT 1;');
|
||||||
if($screenshot->rowCount() == 1)
|
if($image->rowCount() == 1)
|
||||||
$screenshot = $screenshot->fetch();
|
$image = $image->fetch();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo 'Screenshot with this name does not exists.';
|
echo 'Image with this name does not exists.';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$previous_screenshot = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'screenshots` WHERE `id` = ' . $db->quote($screenshot['id'] - 1) . ' ORDER by `ordering`;');
|
$previous_image = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'gallery` WHERE `id` = ' . $db->quote($image['id'] - 1) . ' ORDER by `ordering`;');
|
||||||
if($previous_screenshot->rowCount() == 1)
|
if($previous_image->rowCount() == 1)
|
||||||
$previous_screenshot = $previous_screenshot->fetch();
|
$previous_image = $previous_image->fetch();
|
||||||
else
|
else
|
||||||
$previous_screenshot = NULL;
|
$previous_image = NULL;
|
||||||
|
|
||||||
$next_screenshot = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'screenshots` WHERE `id` = ' . $db->quote($screenshot['id'] + 1) . ' ORDER by `ordering`;');
|
$next_image = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'gallery` WHERE `id` = ' . $db->quote($image['id'] + 1) . ' ORDER by `ordering`;');
|
||||||
if($next_screenshot->rowCount() == 1)
|
if($next_image->rowCount() == 1)
|
||||||
$next_screenshot = $next_screenshot->fetch();
|
$next_image = $next_image->fetch();
|
||||||
else
|
else
|
||||||
$next_screenshot = NULL;
|
$next_image = NULL;
|
||||||
|
|
||||||
echo $twig->render('screenshots.get.html.twig', array(
|
echo $twig->render('gallery.get.html.twig', array(
|
||||||
'previous' => $previous_screenshot ? $previous_screenshot['id'] : null,
|
'previous' => $previous_image ? $previous_image['id'] : null,
|
||||||
'next' => $next_screenshot ? $next_screenshot['id'] : null,
|
'next' => $next_image ? $next_image['id'] : null,
|
||||||
'screenshot' => $screenshot
|
'image' => $image
|
||||||
));
|
));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$screenshots =
|
$images =
|
||||||
$db->query('SELECT `id`, `comment`, `image`, `author`, `thumb`' .
|
$db->query('SELECT `id`, `comment`, `image`, `author`, `thumb`' .
|
||||||
($canEdit ? ', `hidden`, `ordering`' : '') .
|
($canEdit ? ', `hidden`, `ordering`' : '') .
|
||||||
' FROM `' . TABLE_PREFIX . 'screenshots`' .
|
' FROM `' . TABLE_PREFIX . 'gallery`' .
|
||||||
(!$canEdit ? ' WHERE `hidden` != 1' : '') .
|
(!$canEdit ? ' WHERE `hidden` != 1' : '') .
|
||||||
' ORDER BY `ordering`;');
|
' ORDER BY `ordering`;');
|
||||||
|
|
||||||
$last = $screenshots->rowCount();
|
$last = $images->rowCount();
|
||||||
if(!$last)
|
if(!$last)
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
There are no screenshots added to gallery yet.
|
There are no images added to gallery yet.
|
||||||
<?php
|
<?php
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $twig->render('screenshots.html.twig', array(
|
echo $twig->render('gallery.html.twig', array(
|
||||||
'screenshots' => $screenshots,
|
'images' => $images,
|
||||||
'last' => $last,
|
'last' => $last,
|
||||||
'canEdit' => $canEdit
|
'canEdit' => $canEdit
|
||||||
));
|
));
|
||||||
|
|
||||||
class Screenshots
|
class Gallery
|
||||||
{
|
{
|
||||||
static public function add($comment, $image, $author, &$errors)
|
static public function add($comment, $image, $author, &$errors)
|
||||||
{
|
{
|
||||||
@ -132,7 +132,7 @@ class Screenshots
|
|||||||
$query =
|
$query =
|
||||||
$db->query(
|
$db->query(
|
||||||
'SELECT `ordering`' .
|
'SELECT `ordering`' .
|
||||||
' FROM `' . TABLE_PREFIX . 'screenshots`' .
|
' FROM `' . TABLE_PREFIX . 'gallery`' .
|
||||||
' ORDER BY `ordering`' . ' DESC LIMIT 1'
|
' ORDER BY `ordering`' . ' DESC LIMIT 1'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -144,9 +144,9 @@ class Screenshots
|
|||||||
|
|
||||||
$pathinfo = pathinfo($image);
|
$pathinfo = pathinfo($image);
|
||||||
$extension = strtolower($pathinfo['extension']);
|
$extension = strtolower($pathinfo['extension']);
|
||||||
$thumb_filename = 'images/screenshots/' . $pathinfo['filename'] . '_thumb.' . $extension;
|
$thumb_filename = 'images/gallery/' . $pathinfo['filename'] . '_thumb.' . $extension;
|
||||||
$filename = 'images/screenshots/' . $pathinfo['filename'] . '.' . $extension;
|
$filename = 'images/gallery/' . $pathinfo['filename'] . '.' . $extension;
|
||||||
if($db->insert(TABLE_PREFIX . 'screenshots', array(
|
if($db->insert(TABLE_PREFIX . 'gallery', array(
|
||||||
'comment' => $comment,
|
'comment' => $comment,
|
||||||
'image' => $filename, 'author' => $author,
|
'image' => $filename, 'author' => $author,
|
||||||
'thumb' => $thumb_filename,
|
'thumb' => $thumb_filename,
|
||||||
@ -163,7 +163,7 @@ class Screenshots
|
|||||||
|
|
||||||
static public function get($id) {
|
static public function get($id) {
|
||||||
global $db;
|
global $db;
|
||||||
return $db->select(TABLE_PREFIX . 'screenshots', array('id' => $id));
|
return $db->select(TABLE_PREFIX . 'gallery', array('id' => $id));
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function update($id, $comment, $image, $author) {
|
static public function update($id, $comment, $image, $author) {
|
||||||
@ -171,9 +171,9 @@ class Screenshots
|
|||||||
|
|
||||||
$pathinfo = pathinfo($image);
|
$pathinfo = pathinfo($image);
|
||||||
$extension = strtolower($pathinfo['extension']);
|
$extension = strtolower($pathinfo['extension']);
|
||||||
$filename = 'images/screenshots/' . $pathinfo['filename'] . '.' . $extension;
|
$filename = 'images/gallery/' . $pathinfo['filename'] . '.' . $extension;
|
||||||
|
|
||||||
if($db->update(TABLE_PREFIX . 'screenshots', array(
|
if($db->update(TABLE_PREFIX . 'gallery', array(
|
||||||
'comment' => $comment,
|
'comment' => $comment,
|
||||||
'image' => $filename, 'author' => $author),
|
'image' => $filename, 'author' => $author),
|
||||||
array('id' => $id)
|
array('id' => $id)
|
||||||
@ -189,9 +189,9 @@ class Screenshots
|
|||||||
if(isset($id))
|
if(isset($id))
|
||||||
{
|
{
|
||||||
if(self::get($id) !== false)
|
if(self::get($id) !== false)
|
||||||
$db->delete(TABLE_PREFIX . 'screenshots', array('id' => $id));
|
$db->delete(TABLE_PREFIX . 'gallery', array('id' => $id));
|
||||||
else
|
else
|
||||||
$errors[] = 'Screenshot with id ' . $id . ' does not exists.';
|
$errors[] = 'Image with id ' . $id . ' does not exists.';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$errors[] = 'id not set';
|
$errors[] = 'id not set';
|
||||||
@ -206,9 +206,9 @@ class Screenshots
|
|||||||
{
|
{
|
||||||
$query = self::get($id);
|
$query = self::get($id);
|
||||||
if($query !== false)
|
if($query !== false)
|
||||||
$db->update(TABLE_PREFIX . 'screenshots', array('hidden' => ($query['hidden'] == 1 ? 0 : 1)), array('id' => $id));
|
$db->update(TABLE_PREFIX . 'gallery', array('hidden' => ($query['hidden'] == 1 ? 0 : 1)), array('id' => $id));
|
||||||
else
|
else
|
||||||
$errors[] = 'Screenshot with id ' . $id . ' does not exists.';
|
$errors[] = 'Image with id ' . $id . ' does not exists.';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$errors[] = 'id not set';
|
$errors[] = 'id not set';
|
||||||
@ -223,14 +223,14 @@ class Screenshots
|
|||||||
if($query !== false)
|
if($query !== false)
|
||||||
{
|
{
|
||||||
$ordering = $query['ordering'] + $i;
|
$ordering = $query['ordering'] + $i;
|
||||||
$old_record = $db->select(TABLE_PREFIX . 'screenshots', array('ordering' => $ordering));
|
$old_record = $db->select(TABLE_PREFIX . 'gallery', array('ordering' => $ordering));
|
||||||
if($old_record !== false)
|
if($old_record !== false)
|
||||||
$db->update(TABLE_PREFIX . 'screenshots', array('ordering' => $query['ordering']), array('ordering' => $ordering));
|
$db->update(TABLE_PREFIX . 'gallery', array('ordering' => $query['ordering']), array('ordering' => $ordering));
|
||||||
|
|
||||||
$db->update(TABLE_PREFIX . 'screenshots', array('ordering' => $ordering), array('id' => $id));
|
$db->update(TABLE_PREFIX . 'gallery', array('ordering' => $ordering), array('id' => $id));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$errors[] = 'Screenshot with id ' . $id . ' does not exists.';
|
$errors[] = 'Image with id ' . $id . ' does not exists.';
|
||||||
|
|
||||||
return !count($errors);
|
return !count($errors);
|
||||||
}
|
}
|
||||||
@ -290,7 +290,7 @@ class Screenshots
|
|||||||
{
|
{
|
||||||
$pathinfo = pathinfo($file);
|
$pathinfo = pathinfo($file);
|
||||||
$extension = strtolower($pathinfo['extension']);
|
$extension = strtolower($pathinfo['extension']);
|
||||||
$thumb_filename = 'images/screenshots/' . $pathinfo['filename'] . '_thumb.' . $extension;
|
$thumb_filename = 'images/gallery/' . $pathinfo['filename'] . '_thumb.' . $extension;
|
||||||
|
|
||||||
if(!self::resize($file, 170, 110, $thumb_filename, $errors))
|
if(!self::resize($file, 170, 110, $thumb_filename, $errors))
|
||||||
return false;
|
return false;
|
||||||
@ -300,9 +300,9 @@ class Screenshots
|
|||||||
{
|
{
|
||||||
$query = self::get($id);
|
$query = self::get($id);
|
||||||
if($query !== false)
|
if($query !== false)
|
||||||
$db->update(TABLE_PREFIX . 'screenshots', array('thumb' => $thumb_filename), array('id' => $id));
|
$db->update(TABLE_PREFIX . 'gallery', array('thumb' => $thumb_filename), array('id' => $id));
|
||||||
else
|
else
|
||||||
$errors[] = 'Screenshot with id ' . $id . ' does not exists.';
|
$errors[] = 'Image with id ' . $id . ' does not exists.';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$errors[] = 'id not set';
|
$errors[] = 'id not set';
|
@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Movies
|
|
||||||
*
|
|
||||||
* @package MyAAC
|
|
||||||
* @author Slawkens <slawkens@gmail.com>
|
|
||||||
* @copyright 2017 MyAAC
|
|
||||||
* @version 0.5.1
|
|
||||||
* @link http://my-aac.org
|
|
||||||
*/
|
|
||||||
defined('MYAAC') or die('Direct access not allowed!');
|
|
||||||
$title = 'Movies';
|
|
||||||
|
|
||||||
$movies = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'movies` ORDER BY `ordering`;');
|
|
||||||
if(!$movies->rowCount())
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
There are no movies added yet.
|
|
||||||
<?php
|
|
||||||
if(admin())
|
|
||||||
echo ' You can add new movies in phpmyadmin under ' . TABLE_PREFIX . 'movies table.';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo $twig->render('movies.html.twig', array(
|
|
||||||
'movies' => $movies
|
|
||||||
));
|
|
||||||
?>
|
|
28
system/pages/videos.php
Normal file
28
system/pages/videos.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Videos
|
||||||
|
*
|
||||||
|
* @package MyAAC
|
||||||
|
* @author Slawkens <slawkens@gmail.com>
|
||||||
|
* @copyright 2017 MyAAC
|
||||||
|
* @version 0.5.1
|
||||||
|
* @link http://my-aac.org
|
||||||
|
*/
|
||||||
|
defined('MYAAC') or die('Direct access not allowed!');
|
||||||
|
$title = 'Videos';
|
||||||
|
|
||||||
|
$videos = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'videos` ORDER BY `ordering`;');
|
||||||
|
if(!$videos->rowCount())
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
There are no videos added yet.
|
||||||
|
<?php
|
||||||
|
if(admin())
|
||||||
|
echo ' You can add new videos in phpmyadmin under ' . TABLE_PREFIX . 'videos table.';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $twig->render('videos.html.twig', array(
|
||||||
|
'videos' => $videos
|
||||||
|
));
|
||||||
|
?>
|
@ -79,11 +79,14 @@ $template['link_account_logout'] = getLink('account/logout');
|
|||||||
|
|
||||||
$template['link_news_archive'] = getLink('news/archive');
|
$template['link_news_archive'] = getLink('news/archive');
|
||||||
|
|
||||||
$links = array('news', 'changelog', 'rules', 'downloads', 'characters', 'online', 'highscores', 'powergamers', 'lastkills', 'houses', 'guilds', 'wars', 'polls', 'bans', 'team', 'creatures', 'spells', 'commands', 'experienceStages', 'freeHouses', 'screenshots', 'movies', 'serverInfo', 'experienceTable', 'faq', 'points', 'gifts', 'bugtracker');
|
$links = array('news', 'changelog', 'rules', 'downloads', 'characters', 'online', 'highscores', 'powergamers', 'lastkills', 'houses', 'guilds', 'wars', 'polls', 'bans', 'team', 'creatures', 'spells', 'commands', 'experienceStages', 'freeHouses', 'serverInfo', 'experienceTable', 'faq', 'points', 'gifts', 'bugtracker');
|
||||||
foreach($links as $link) {
|
foreach($links as $link) {
|
||||||
$template['link_' . $link] = getLink($link);
|
$template['link_' . $link] = getLink($link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$template['link_screenshots'] = getLink('gallery');
|
||||||
|
$template['link_movies'] = getLink('videos');
|
||||||
|
|
||||||
$template['link_gifts_history'] = getLink('gifts', 'history');
|
$template['link_gifts_history'] = getLink('gifts', 'history');
|
||||||
if($config['forum'] != '')
|
if($config['forum'] != '')
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<table width="100%" border="0" cellspacing="1" cellpadding="4">
|
<table width="100%" border="0" cellspacing="1" cellpadding="4">
|
||||||
<tr>
|
<tr>
|
||||||
<td bgcolor="{{ config.vdarkborder }}" class="white"><b>{% if action == 'edit' %}Edit{% else %}Add{% endif %} screenshot</b></td>
|
<td bgcolor="{{ config.vdarkborder }}" class="white"><b>{% if action == 'edit' %}Edit{% else %}Add{% endif %} image</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td bgcolor="{{ config.darkborder }}">
|
<td bgcolor="{{ config.darkborder }}">
|
15
system/templates/gallery.get.html.twig
Normal file
15
system/templates/gallery.get.html.twig
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<div style="position: relative; height: 15px; width: 100%;">
|
||||||
|
{% if next is not null %}
|
||||||
|
<a style="float: right;" href="?subtopic=gallery&image={{ next }}" >next <img src="images/arrow_right.gif" width=15 height=11 border=0 ></a>
|
||||||
|
{% endif %}
|
||||||
|
{% if previous is not null %}
|
||||||
|
<a style="position: absolute;" href="?subtopic=gallery&image={{ previous }}"><img src="images/arrow_left.gif" width=15 height=11 border=0 > previous</a>
|
||||||
|
{% endif %}
|
||||||
|
<div style="position: absolute; width: 80%; margin-left: 10%; margin-right: 10%; text-align: center;">
|
||||||
|
<a href="{{ getLink('gallery') }}" ><img src="images/arrow_up.gif" width=11 height=15 border=0 > back</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="position: relative; text-align: center; top: 20px; ">
|
||||||
|
<img src="{{ image.image }}" />
|
||||||
|
<div style="margin-top: 15px; margin-bottom: 35px; ">{{ image.comment }}</div>
|
||||||
|
</div>
|
38
system/templates/gallery.html.twig
Normal file
38
system/templates/gallery.html.twig
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
Click on the image to enlarge.<br/><br/>
|
||||||
|
{% set i = 0 %}
|
||||||
|
{% for item in gallery %}
|
||||||
|
{% set i = i + 1 %}
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td style="height: 120px;" >
|
||||||
|
<a href="?subtopic=gallery&image={{ item.id }}" >
|
||||||
|
<img src="{{ item.thumb }}" border="0" />
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>{{ item.comment }}</td>
|
||||||
|
{% if canEdit %}
|
||||||
|
<td>
|
||||||
|
<a href="?subtopic=gallery&action=edit&id={{ item.id }}" title="Edit">
|
||||||
|
<img src="images/edit.png"/>Edit
|
||||||
|
</a>
|
||||||
|
<a id="delete" href="?subtopic=gallery&action=delete&id={{ item.id }}" onclick="return confirm('Are you sure?');" title="Delete">
|
||||||
|
<img src="images/del.png"/>Delete
|
||||||
|
</a>
|
||||||
|
<a href="?subtopic=gallery&action=hide&id={{ item.id }}" title="{% if item.hidden != 1 %}Hide{% else %}Show{% endif %}">
|
||||||
|
<img src="images/{% if item.hidden != 1 %}success{% else %}error{% endif %}.png"/>{% if item.hidden != 1 %}Hide{% else %}Show{% endif %}
|
||||||
|
</a>
|
||||||
|
{% if i != 1 %}
|
||||||
|
<a href="?subtopic=gallery&action=moveup&id={{ item.id }}" title="Move up">
|
||||||
|
<img src="images/icons/arrow_up.gif"/>Move up
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if i != last %}
|
||||||
|
<a href="?subtopic=gallery&action=movedown&id={{ item.id }}" title="Move down">
|
||||||
|
<img src="images/icons/arrow_down.gif"/>Move down
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
{% endfor %}
|
@ -1,7 +0,0 @@
|
|||||||
<div style="text-align: center;">
|
|
||||||
{% for movie in movies %}
|
|
||||||
<h2>{{ movie.title }}</h2>
|
|
||||||
Author: {{ movie.author }}<br/>
|
|
||||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/{{ movie.youtube_id }}" frameborder="0" allowfullscreen></iframe><br/><br/>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
@ -1,16 +0,0 @@
|
|||||||
<div style="position: relative; height: 15px; width: 100%;">
|
|
||||||
<?php if($next_screenshot): ?>
|
|
||||||
{% if next is not null %}
|
|
||||||
<a style="float: right;" href="?subtopic=screenshots&screenshot={{ next }}" >next <img src="images/arrow_right.gif" width=15 height=11 border=0 ></a>
|
|
||||||
{% endif %}
|
|
||||||
{% if previous is not null %}
|
|
||||||
<a style="position: absolute;" href="?subtopic=screenshots&screenshot={{ previous }}"><img src="images/arrow_left.gif" width=15 height=11 border=0 > previous</a>
|
|
||||||
{% endif %}
|
|
||||||
<div style="position: absolute; width: 80%; margin-left: 10%; margin-right: 10%; text-align: center;">
|
|
||||||
<a href="?subtopic=screenshots" ><img src="images/arrow_up.gif" width=11 height=15 border=0 > back</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="position: relative; text-align: center; top: 20px; ">
|
|
||||||
<img src="{{ screenshot.image }}" />
|
|
||||||
<div style="margin-top: 15px; margin-bottom: 35px; ">{{ screenshot.comment }}</div>
|
|
||||||
</div>
|
|
@ -1,38 +0,0 @@
|
|||||||
Click on the image to enlarge.<br/><br/>
|
|
||||||
{% set i = 0 %}
|
|
||||||
{% for screenshot in screenshots %}
|
|
||||||
{% set i = i + 1 %}
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td style="height: 120px;" >
|
|
||||||
<a href="?subtopic=screenshots&screenshot={{ screenshot.id }}" >
|
|
||||||
<img src="{{ screenshot.thumb }}" border="0" />
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>{{ screenshot.comment }}</td>
|
|
||||||
{% if canEdit %}
|
|
||||||
<td>
|
|
||||||
<a href="?subtopic=screenshots&action=edit&id={{ screenshot.id }}" title="Edit">
|
|
||||||
<img src="images/edit.png"/>Edit
|
|
||||||
</a>
|
|
||||||
<a id="delete" href="?subtopic=screenshots&action=delete&id={{ screenshot.id }}" onclick="return confirm('Are you sure?');" title="Delete">
|
|
||||||
<img src="images/del.png"/>Delete
|
|
||||||
</a>
|
|
||||||
<a href="?subtopic=screenshots&action=hide&id={{ screenshot.id }}" title="{% if screenshot.hidden != 1 %}Hide{% else %}Show{% endif %}">
|
|
||||||
<img src="images/{% if screenshot.hidden != 1 %}success{% else %}error{% endif %}.png"/>{% if screenshot.hidden != 1 %}Hide{% else %}Show{% endif %}
|
|
||||||
</a>
|
|
||||||
{% if i != 1 %}
|
|
||||||
<a href="?subtopic=screenshots&action=moveup&id={{ screenshot.id }}" title="Move up">
|
|
||||||
<img src="images/icons/arrow_up.gif"/>Move up
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
{% if i != last %}
|
|
||||||
<a href="?subtopic=screenshots&action=movedown&id={{ screenshot.id }}" title="Move down">
|
|
||||||
<img src="images/icons/arrow_down.gif"/>Move down
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
{% endif %}
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
{% endfor %}
|
|
7
system/templates/videos.html.twig
Normal file
7
system/templates/videos.html.twig
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<div style="text-align: center;">
|
||||||
|
{% for video in videos %}
|
||||||
|
<h2>{{ video.title }}</h2>
|
||||||
|
Author: {{ video.author }}<br/>
|
||||||
|
<iframe width="560" height="315" src="https://www.youtube.com/embed/{{ video.youtube_id }}" frameborder="0" allowfullscreen></iframe><br/><br/>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
@ -17,7 +17,7 @@ defined('MYAAC') or die('Direct access not allowed!');
|
|||||||
if(in_array(PAGE, array('news', 'newsarchive')))
|
if(in_array(PAGE, array('news', 'newsarchive')))
|
||||||
echo 'news';
|
echo 'news';
|
||||||
elseif(in_array(PAGE, array('creatures', 'spells', 'serverinfo', 'downloads', 'commands',
|
elseif(in_array(PAGE, array('creatures', 'spells', 'serverinfo', 'downloads', 'commands',
|
||||||
'movies', 'screenshots', 'experiencetable', 'faq')))
|
'videos', 'gallery', 'experiencetable', 'faq')))
|
||||||
echo 'library';
|
echo 'library';
|
||||||
elseif(in_array(PAGE, array('online', 'characters', 'guilds', 'highscores', 'wars', 'lastkills', 'houses', 'bans',
|
elseif(in_array(PAGE, array('online', 'characters', 'guilds', 'highscores', 'wars', 'lastkills', 'houses', 'bans',
|
||||||
'forum', 'team')))
|
'forum', 'team')))
|
||||||
@ -134,9 +134,9 @@ defined('MYAAC') or die('Direct access not allowed!');
|
|||||||
<span class="separator"></span>
|
<span class="separator"></span>
|
||||||
<a href="<?php echo getLink('commands'); ?>">Commands</a>
|
<a href="<?php echo getLink('commands'); ?>">Commands</a>
|
||||||
<span class="separator"></span>
|
<span class="separator"></span>
|
||||||
<a href="<?php echo getLink('movies'); ?>">Movies</a>
|
<a href="<?php echo getLink('videos'); ?>">Videos</a>
|
||||||
<span class="separator"></span>
|
<span class="separator"></span>
|
||||||
<a href="<?php echo getLink('screenshots'); ?>">Screenshots</a>
|
<a href="<?php echo getLink('gallery'); ?>">Gallery</a>
|
||||||
<span class="separator"></span>
|
<span class="separator"></span>
|
||||||
<a href="<?php echo getLink('experienceTable'); ?>">Experience Table</a>
|
<a href="<?php echo getLink('experienceTable'); ?>">Experience Table</a>
|
||||||
<span class="separator"></span>
|
<span class="separator"></span>
|
||||||
|
@ -712,7 +712,7 @@ img {
|
|||||||
#Themeboxes #JobBox {
|
#Themeboxes #JobBox {
|
||||||
height: 164px;
|
height: 164px;
|
||||||
}
|
}
|
||||||
#Themeboxes #ScreenshotBox #ScreenshotContent {
|
#Themeboxes #GalleryBox #GalleryContent {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 111px;
|
height: 111px;
|
||||||
width: 170px;
|
width: 170px;
|
||||||
|
@ -4,9 +4,10 @@ $config['lightborder'] = "#F1E0C6";
|
|||||||
$config['vdarkborder'] = "#505050";
|
$config['vdarkborder'] = "#505050";
|
||||||
$config['news_title_color'] = "white";
|
$config['news_title_color'] = "white";
|
||||||
$config['logo_monster'] = "Elder Beholder";
|
$config['logo_monster'] = "Elder Beholder";
|
||||||
#List: newcomer,screenshots,premium,poll
|
// separated by comma
|
||||||
$config['boxes'] = "newcomer,screenshots";
|
// List: newcomer,gallery,premium,poll
|
||||||
|
$config['boxes'] = "newcomer,gallery";
|
||||||
$config['background_image'] = "background-artwork-860.jpg";
|
$config['background_image'] = "background-artwork-860.jpg";
|
||||||
$config['logo_image'] = "tibia-logo-artwork-top.gif";
|
$config['logo_image'] = "tibia-logo-artwork-top.gif";
|
||||||
$config['screenshot'] = "demon";
|
$config['gallery_image'] = 1;
|
||||||
?>
|
?>
|
||||||
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
@ -560,19 +560,19 @@ if(isset($config['freehouses'])): ?>
|
|||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<a href="<?php echo getLink('screenshots'); ?>">
|
<a href="<?php echo getLink('gallery'); ?>">
|
||||||
<div id='submenu_screenshots' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
|
<div id='submenu_gallery' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
|
||||||
<div class='LeftChain' style='background-image:url(<?php echo $template_path; ?>/images/general/chain.gif);'></div>
|
<div class='LeftChain' style='background-image:url(<?php echo $template_path; ?>/images/general/chain.gif);'></div>
|
||||||
<div id='ActiveSubmenuItemIcon_screenshots' class='ActiveSubmenuItemIcon' style='background-image:url(<?php echo $template_path; ?>/images/menu/icon-activesubmenu.gif);'></div>
|
<div id='ActiveSubmenuItemIcon_gallery' class='ActiveSubmenuItemIcon' style='background-image:url(<?php echo $template_path; ?>/images/menu/icon-activesubmenu.gif);'></div>
|
||||||
<div class='SubmenuitemLabel'>Screenshots</div>
|
<div class='SubmenuitemLabel'>Gallery</div>
|
||||||
<div class='RightChain' style='background-image:url(<?php echo $template_path; ?>/images/general/chain.gif);'></div>
|
<div class='RightChain' style='background-image:url(<?php echo $template_path; ?>/images/general/chain.gif);'></div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="<?php echo getLink('movies'); ?>">
|
<a href="<?php echo getLink('videos'); ?>">
|
||||||
<div id='submenu_movies' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
|
<div id='submenu_videos' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
|
||||||
<div class='LeftChain' style='background-image:url(<?php echo $template_path; ?>/images/general/chain.gif);'></div>
|
<div class='LeftChain' style='background-image:url(<?php echo $template_path; ?>/images/general/chain.gif);'></div>
|
||||||
<div id='ActiveSubmenuItemIcon_movies' class='ActiveSubmenuItemIcon' style='background-image:url(<?php echo $template_path; ?>/images/menu/icon-activesubmenu.gif);'></div>
|
<div id='ActiveSubmenuItemIcon_videos' class='ActiveSubmenuItemIcon' style='background-image:url(<?php echo $template_path; ?>/images/menu/icon-activesubmenu.gif);'></div>
|
||||||
<div class='SubmenuitemLabel'>Movies</div>
|
<div class='SubmenuitemLabel'>Videos</div>
|
||||||
<div class='RightChain' style='background-image:url(<?php echo $template_path; ?>/images/general/chain.gif);'></div>
|
<div class='RightChain' style='background-image:url(<?php echo $template_path; ?>/images/general/chain.gif);'></div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
@ -756,13 +756,19 @@ if($logged):
|
|||||||
<div class="Bottom" style="background-image:url(<?php echo $template_path; ?>/images/general/box-bottom.gif);"></div>
|
<div class="Bottom" style="background-image:url(<?php echo $template_path; ?>/images/general/box-bottom.gif);"></div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if(PAGE == 'news' && in_array("screenshots", $config['boxes'])): ?>
|
<?php
|
||||||
<div id="ScreenshotBox" class="Themebox" style="background-image:url(<?php echo $template_path; ?>/images/themeboxes/screenshot/screenshotbox.gif);">
|
if(PAGE == 'news' && in_array("gallery", $config['boxes'])):
|
||||||
<a href="?subtopic=screenshots&screenshot=<?php echo $config['screenshot']; ?>" >
|
$query = $db->query('SELECT `thumb` FROM `' . TABLE_PREFIX . 'gallery` WHERE `id` = ' . $db->quote($config['gallery_image']));
|
||||||
<img id="ScreenshotContent" class="ThemeboxContent" src="images/screenshots/<?php echo $config['screenshot']; ?>_thumb.gif" alt="Screenshot of the Day" />
|
if($query->rowCount() == 1):
|
||||||
|
$image = $query->fetch();
|
||||||
|
?>
|
||||||
|
<div id="GalleryBox" class="Themebox" style="background-image:url(<?php echo $template_path; ?>/images/themeboxes/gallery/gallerybox.gif);">
|
||||||
|
<a href="?subtopic=gallery&image=<?php echo $config['gallery_image']; ?>" >
|
||||||
|
<img id="GalleryContent" class="ThemeboxContent" src="<?php echo $image['thumb']; ?>" alt="Screenshot of the Day" />
|
||||||
</a>
|
</a>
|
||||||
<div class="Bottom" style="background-image:url(<?php echo $template_path; ?>/images/general/box-bottom.gif);"></div>
|
<div class="Bottom" style="background-image:url(<?php echo $template_path; ?>/images/general/box-bottom.gif);"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if(PAGE == 'news' && in_array("poll", $config['boxes'])):
|
<?php if(PAGE == 'news' && in_array("poll", $config['boxes'])):
|
||||||
$poll = $db->query('SELECT id, question FROM '.$db->tableName(TABLE_PREFIX . 'polls') . ' WHERE end > ' . time() . ' ORDER BY end LIMIT 1');
|
$poll = $db->query('SELECT id, question FROM '.$db->tableName(TABLE_PREFIX . 'polls') . ' WHERE end > ' . time() . ' ORDER BY end LIMIT 1');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user