mirror of
https://github.com/Circlepuller/Tinyboard.git
synced 2025-04-22 07:12:02 +02:00
Added a description in composer.json
This commit is contained in:
parent
29d37104e8
commit
3fd37ab2fc
2
.gitignore
vendored
2
.gitignore
vendored
@ -47,3 +47,5 @@ Thumbs.db
|
||||
#vichan custom
|
||||
favicon.ico
|
||||
/static/spoiler.png
|
||||
|
||||
/vendor/
|
||||
|
20
composer.json
Normal file
20
composer.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "circlepuller/tinyboard",
|
||||
"description": "Tinyboard is a light-weight, fast, highly configurable and user-friendly imageboard software package released under a non-restrictive open-source license. It is written in PHP and has few dependencies.",
|
||||
"type": "project",
|
||||
"require": {
|
||||
"gettext/gettext": "^4.4",
|
||||
"twig/twig": "^2.4",
|
||||
"twig/extensions": "^1.5",
|
||||
"maxmind/geoip": "^1.1",
|
||||
"mrclay/minify": "^3.0",
|
||||
"lifo/ip": "^1.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Daniel Saunders",
|
||||
"email": "dsaunders@dansaunders.me"
|
||||
}
|
||||
]
|
||||
}
|
2434
composer.lock
generated
Normal file
2434
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,5 @@
|
||||
<?php
|
||||
|
||||
require 'inc/lib/IP/Lifo/IP/IP.php';
|
||||
require 'inc/lib/IP/Lifo/IP/BC.php';
|
||||
require 'inc/lib/IP/Lifo/IP/CIDR.php';
|
||||
|
||||
use Lifo\IP\CIDR;
|
||||
|
||||
class Bans {
|
||||
|
@ -22,11 +22,10 @@ require_once 'inc/mod/auth.php';
|
||||
require_once 'inc/lock.php';
|
||||
require_once 'inc/queue.php';
|
||||
require_once 'inc/polyfill.php';
|
||||
@include_once 'inc/lib/parsedown/Parsedown.php'; // fail silently, this isn't a critical piece of code
|
||||
|
||||
if (!extension_loaded('gettext')) {
|
||||
require_once 'inc/lib/gettext/gettext.inc';
|
||||
}
|
||||
require_once 'vendor/autoload.php';
|
||||
|
||||
@include_once 'inc/lib/parsedown/Parsedown.php'; // fail silently, this isn't a critical piece of code
|
||||
|
||||
// the user is not currently logged in as a moderator
|
||||
$mod = false;
|
||||
@ -1763,8 +1762,7 @@ function buildJavascript() {
|
||||
}
|
||||
}
|
||||
|
||||
if ($config['minify_js']) {
|
||||
require_once 'inc/lib/minify/JSMin.php';
|
||||
if ($config['minify_js']) {
|
||||
$script = JSMin::minify($script);
|
||||
}
|
||||
|
||||
|
140
inc/template.php
140
inc/template.php
@ -6,18 +6,19 @@
|
||||
|
||||
defined('TINYBOARD') or exit;
|
||||
|
||||
require_once 'vendor/autoload.php';
|
||||
|
||||
$twig = false;
|
||||
|
||||
function load_twig() {
|
||||
global $twig, $config;
|
||||
|
||||
require 'lib/Twig/Autoloader.php';
|
||||
Twig_Autoloader::register();
|
||||
/*Twig_Autoloader::register();
|
||||
|
||||
Twig_Autoloader::autoload('Twig_Extensions_Node_Trans');
|
||||
Twig_Autoloader::autoload('Twig_Extensions_TokenParser_Trans');
|
||||
Twig_Autoloader::autoload('Twig_Extensions_Extension_I18n');
|
||||
Twig_Autoloader::autoload('Twig_Extensions_Extension_Tinyboard');
|
||||
Twig_Autoloader::autoload('Twig_Extensions_Extension_Tinyboard');*/
|
||||
|
||||
$loader = new Twig_Loader_Filesystem($config['dir']['template']);
|
||||
$loader->setPaths($config['dir']['template']);
|
||||
@ -76,3 +77,136 @@ function Element($templateFile, array $options) {
|
||||
}
|
||||
}
|
||||
|
||||
class Twig_Extensions_Extension_Tinyboard extends Twig_Extension
|
||||
{
|
||||
/**
|
||||
* Returns a list of filters to add to the existing list.
|
||||
*
|
||||
* @return array An array of filters
|
||||
*/
|
||||
public function getFilters()
|
||||
{
|
||||
return array(
|
||||
new Twig_SimpleFilter('filesize', 'format_bytes'),
|
||||
new Twig_SimpleFilter('truncate', 'twig_truncate_filter'),
|
||||
new Twig_SimpleFilter('truncate_body', 'truncate'),
|
||||
new Twig_SimpleFilter('truncate_filename', 'twig_filename_truncate_filter'),
|
||||
new Twig_SimpleFilter('extension', 'twig_extension_filter'),
|
||||
new Twig_SimpleFilter('sprintf', 'sprintf'),
|
||||
new Twig_SimpleFilter('capcode', 'capcode'),
|
||||
new Twig_SimpleFilter('remove_modifiers', 'remove_modifiers'),
|
||||
new Twig_SimpleFilter('hasPermission', 'twig_hasPermission_filter'),
|
||||
new Twig_SimpleFilter('date', 'twig_date_filter'),
|
||||
new Twig_SimpleFilter('poster_id', 'poster_id'),
|
||||
new Twig_SimpleFilter('remove_whitespace', 'twig_remove_whitespace_filter'),
|
||||
new Twig_SimpleFilter('count', 'count'),
|
||||
new Twig_SimpleFilter('ago', 'ago'),
|
||||
new Twig_SimpleFilter('until', 'until'),
|
||||
new Twig_SimpleFilter('push', 'twig_push_filter'),
|
||||
new Twig_SimpleFilter('bidi_cleanup', 'bidi_cleanup'),
|
||||
new Twig_SimpleFilter('addslashes', 'addslashes'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of functions to add to the existing list.
|
||||
*
|
||||
* @return array An array of filters
|
||||
*/
|
||||
public function getFunctions()
|
||||
{
|
||||
return array(
|
||||
new Twig_SimpleFunction('time', 'time'),
|
||||
new Twig_SimpleFunction('floor', 'floor'),
|
||||
new Twig_SimpleFunction('timezone', 'twig_timezone_function'),
|
||||
new Twig_SimpleFunction('hiddenInputs', 'hiddenInputs'),
|
||||
new Twig_SimpleFunction('hiddenInputsHash', 'hiddenInputsHash'),
|
||||
new Twig_SimpleFunction('ratio', 'twig_ratio_function'),
|
||||
new Twig_SimpleFunction('secure_link_confirm', 'twig_secure_link_confirm'),
|
||||
new Twig_SimpleFunction('secure_link', 'twig_secure_link'),
|
||||
new Twig_SimpleFunction('link_for', 'link_for')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the extension.
|
||||
*
|
||||
* @return string The extension name
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'tinyboard';
|
||||
}
|
||||
}
|
||||
|
||||
function twig_timezone_function() {
|
||||
return 'Z';
|
||||
}
|
||||
|
||||
function twig_push_filter($array, $value) {
|
||||
array_push($array, $value);
|
||||
return $array;
|
||||
}
|
||||
|
||||
function twig_remove_whitespace_filter($data) {
|
||||
return preg_replace('/[\t\r\n]/', '', $data);
|
||||
}
|
||||
|
||||
function twig_date_filter($date, $format) {
|
||||
return gmstrftime($format, $date);
|
||||
}
|
||||
|
||||
function twig_hasPermission_filter($mod, $permission, $board = null) {
|
||||
return hasPermission($permission, $board, $mod);
|
||||
}
|
||||
|
||||
function twig_extension_filter($value, $case_insensitive = true) {
|
||||
$ext = mb_substr($value, mb_strrpos($value, '.') + 1);
|
||||
if($case_insensitive)
|
||||
$ext = mb_strtolower($ext);
|
||||
return $ext;
|
||||
}
|
||||
|
||||
function twig_sprintf_filter( $value, $var) {
|
||||
return sprintf($value, $var);
|
||||
}
|
||||
|
||||
function twig_truncate_filter($value, $length = 30, $preserve = false, $separator = '…') {
|
||||
if (mb_strlen($value) > $length) {
|
||||
if ($preserve) {
|
||||
if (false !== ($breakpoint = mb_strpos($value, ' ', $length))) {
|
||||
$length = $breakpoint;
|
||||
}
|
||||
}
|
||||
return mb_substr($value, 0, $length) . $separator;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
function twig_filename_truncate_filter($value, $length = 30, $separator = '…') {
|
||||
if (mb_strlen($value) > $length) {
|
||||
$value = strrev($value);
|
||||
$array = array_reverse(explode(".", $value, 2));
|
||||
$array = array_map("strrev", $array);
|
||||
|
||||
$filename = &$array[0];
|
||||
$extension = isset($array[1]) ? $array[1] : false;
|
||||
|
||||
$filename = mb_substr($filename, 0, $length - ($extension ? mb_strlen($extension) + 1 : 0)) . $separator;
|
||||
|
||||
return implode(".", $array);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
function twig_ratio_function($w, $h) {
|
||||
return fraction($w, $h, ':');
|
||||
}
|
||||
function twig_secure_link_confirm($text, $title, $confirm_message, $href) {
|
||||
global $config;
|
||||
|
||||
return '<a onclick="if (event.which==2) return true;if (confirm(\'' . htmlentities(addslashes($confirm_message)) . '\')) document.location=\'?/' . htmlspecialchars(addslashes($href . '/' . make_secure_link_token($href))) . '\';return false;" title="' . htmlentities($title) . '" href="?/' . $href . '">' . $text . '</a>';
|
||||
}
|
||||
function twig_secure_link($href) {
|
||||
return $href . '/' . make_secure_link_token($href);
|
||||
}
|
1
post.php
1
post.php
@ -727,7 +727,6 @@ if (isset($_POST['delete'])) {
|
||||
|
||||
if (!$dropped_post)
|
||||
if (($config['country_flags'] && !$config['allow_no_country']) || ($config['country_flags'] && $config['allow_no_country'] && !isset($_POST['no_country']))) {
|
||||
require 'inc/lib/geoip/geoip.inc';
|
||||
$gi=geoip\geoip_open('inc/lib/geoip/GeoIPv6.dat', GEOIP_STANDARD);
|
||||
|
||||
function ipv4to6($ip) {
|
||||
|
@ -18,7 +18,7 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if config.recaptcha %}<script src="//www.google.com/recaptcha/api.js"></script>
|
||||
<style type="text/css">{% raw %}
|
||||
<style type="text/css">
|
||||
#recaptcha_area {
|
||||
float: none !important;
|
||||
padding: 0 !important;
|
||||
@ -46,4 +46,4 @@
|
||||
.recaptchatable, #recaptcha_area tr, #recaptcha_area td, #recaptcha_area th {
|
||||
padding: 0 !important;
|
||||
}
|
||||
{% endraw %}</style>{% endif %}
|
||||
</style>{% endif %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user