forked from GithubBackups/tinyib
Typos and minor cleanup
This commit is contained in:
parent
21e8b5884d
commit
9b41846002
@ -5,7 +5,7 @@ TinyIB - A Lightweight and Efficient [Image Board](http://en.wikipedia.org/wiki/
|
|||||||
|
|
||||||
**No database? No problem.** Store posts as text files for a portable set-up capable of running on virtually any PHP host.
|
**No database? No problem.** Store posts as text files for a portable set-up capable of running on virtually any PHP host.
|
||||||
|
|
||||||
To allow new threads without requiring an image, see the [Text Board Mode](https://github.com/tslocum/TinyIB/wiki/Text-Board-Mode) page.
|
**Not looking for an image board script?** TinyIB is able to allow new threads without requiring an image, or even disallow images entirely. See the [Text Board Mode](https://github.com/tslocum/TinyIB/wiki/Text-Board-Mode) wiki page for instructions.
|
||||||
|
|
||||||
For demos see the [TinyIB Installations](https://github.com/tslocum/TinyIB/wiki) page.
|
For demos see the [TinyIB Installations](https://github.com/tslocum/TinyIB/wiki) page.
|
||||||
|
|
||||||
|
@ -113,13 +113,13 @@ a:hover {
|
|||||||
color: #000000;
|
color: #000000;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
padding: 0px;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.postlists {
|
.postlists {
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0px;
|
padding: 0;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,13 +91,13 @@ a:hover {
|
|||||||
.managehead {
|
.managehead {
|
||||||
background: #AAAA66;
|
background: #AAAA66;
|
||||||
color: #400000;
|
color: #400000;
|
||||||
padding: 0px;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.postlists {
|
.postlists {
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0px;
|
padding: 0;
|
||||||
color: #800000;
|
color: #800000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
body {
|
body {
|
||||||
margin: 0;
|
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
margin-bottom: auto;
|
margin: 0 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
blockquote blockquote {
|
blockquote blockquote {
|
||||||
margin-left: 0em;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
form {
|
form {
|
||||||
margin-bottom: 0px;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.postarea {
|
.postarea {
|
||||||
@ -17,7 +16,7 @@ form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.postarea table {
|
.postarea table {
|
||||||
margin: 0px auto;
|
margin: 0 auto;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,10 +42,7 @@ form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.message {
|
.message {
|
||||||
margin-top: 1em;
|
margin: 1em 25px;
|
||||||
margin-bottom: 1em;
|
|
||||||
margin-left: 25px;
|
|
||||||
margin-right: 25px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.reply .message {
|
.reply .message {
|
||||||
@ -100,7 +96,7 @@ form {
|
|||||||
|
|
||||||
.rules ul {
|
.rules ul {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding-left: 0px;
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.floatpost {
|
.floatpost {
|
||||||
|
@ -49,7 +49,7 @@ $includes = array("inc/defines.php", "inc/functions.php", "inc/html.php");
|
|||||||
if (in_array(TINYIB_DBMODE, array('flatfile', 'mysql', 'mysqli', 'sqlite', 'pdo'))) {
|
if (in_array(TINYIB_DBMODE, array('flatfile', 'mysql', 'mysqli', 'sqlite', 'pdo'))) {
|
||||||
$includes[] = 'inc/database_' . TINYIB_DBMODE . '.php';
|
$includes[] = 'inc/database_' . TINYIB_DBMODE . '.php';
|
||||||
} else {
|
} else {
|
||||||
fancyDie("Unknown database mode specificed");
|
fancyDie("Unknown database mode specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($includes as $include) {
|
foreach ($includes as $include) {
|
||||||
@ -183,7 +183,7 @@ if (isset($_POST['message']) || isset($_POST['file'])) {
|
|||||||
|
|
||||||
if ($file_mime == "video/webm") {
|
if ($file_mime == "video/webm") {
|
||||||
list($thumb_maxwidth, $thumb_maxheight) = thumbnailDimensions($post);
|
list($thumb_maxwidth, $thumb_maxheight) = thumbnailDimensions($post);
|
||||||
shell_exec("ffmpegthumbnailer -s " . max($thumb_maxwidth, $thumb_maxheight) . " -i $file_location -o $thumb_location") . '!';
|
shell_exec("ffmpegthumbnailer -s " . max($thumb_maxwidth, $thumb_maxheight) . " -i $file_location -o $thumb_location");
|
||||||
|
|
||||||
$thumb_info = getimagesize($thumb_location);
|
$thumb_info = getimagesize($thumb_location);
|
||||||
$post['thumb_width'] = $thumb_info[0];
|
$post['thumb_width'] = $thumb_info[0];
|
||||||
@ -361,7 +361,7 @@ if (isset($_POST['message']) || isset($_POST['file'])) {
|
|||||||
if (is_dir('.git')) {
|
if (is_dir('.git')) {
|
||||||
$git_output = shell_exec('git pull 2>&1');
|
$git_output = shell_exec('git pull 2>&1');
|
||||||
$text .= '<blockquote class="reply" style="padding: 7px;font-size: 1.25em;">
|
$text .= '<blockquote class="reply" style="padding: 7px;font-size: 1.25em;">
|
||||||
<pre style="margin: 0px;padding: 0px;">Attempting update...' . "\n\n" . $git_output . '</pre>
|
<pre style="margin: 0;padding: 0;">Attempting update...' . "\n\n" . $git_output . '</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<p><b>Note:</b> If TinyIB updates and you have made custom modifications, <a href="https://github.com/tslocum/TinyIB/commits/master">review the changes</a> which have been merged into your installation.
|
<p><b>Note:</b> If TinyIB updates and you have made custom modifications, <a href="https://github.com/tslocum/TinyIB/commits/master">review the changes</a> which have been merged into your installation.
|
||||||
Ensure that your modifications do not interfere with any new/modified files.
|
Ensure that your modifications do not interfere with any new/modified files.
|
||||||
|
772
inc/captcha.php
772
inc/captcha.php
@ -1,386 +1,386 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Script for generation of CAPTCHAs
|
* Script for generation of CAPTCHAs
|
||||||
*
|
*
|
||||||
* @author Jose Rodriguez <jose.rodriguez@exec.cl>
|
* @author Jose Rodriguez <jose.rodriguez@exec.cl>
|
||||||
* @license GPLv3
|
* @license GPLv3
|
||||||
* @link http://code.google.com/p/cool-php-captcha
|
* @link http://code.google.com/p/cool-php-captcha
|
||||||
* @version 0.3
|
* @version 0.3
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
putenv('GDFONTPATH=' . realpath('./fonts/'));
|
putenv('GDFONTPATH=' . realpath('./fonts/'));
|
||||||
$captcha = new SimpleCaptcha();
|
$captcha = new SimpleCaptcha();
|
||||||
$captcha->CreateImage();
|
$captcha->CreateImage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SimpleCaptcha class
|
* SimpleCaptcha class
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class SimpleCaptcha {
|
class SimpleCaptcha {
|
||||||
/** Width of the image */
|
/** Width of the image */
|
||||||
public $width = 175;
|
public $width = 175;
|
||||||
|
|
||||||
/** Height of the image */
|
/** Height of the image */
|
||||||
public $height = 55;
|
public $height = 55;
|
||||||
|
|
||||||
/** Dictionary word file (empty for random text) */
|
/** Dictionary word file (empty for random text) */
|
||||||
public $wordsFile = '';
|
public $wordsFile = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Path for resource files (fonts, words, etc.)
|
* Path for resource files (fonts, words, etc.)
|
||||||
*
|
*
|
||||||
* "resources" by default. For security reasons, is better move this
|
* "resources" by default. For security reasons, is better move this
|
||||||
* directory to another location outise the web server
|
* directory to another location outside the web server
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public $resourcesPath = './fonts';
|
public $resourcesPath = './fonts';
|
||||||
|
|
||||||
/** Min word length (for non-dictionary random text generation) */
|
/** Min word length (for non-dictionary random text generation) */
|
||||||
public $minWordLength = 4;
|
public $minWordLength = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Max word length (for non-dictionary random text generation)
|
* Max word length (for non-dictionary random text generation)
|
||||||
*
|
*
|
||||||
* Used for dictionary words indicating the word-length
|
* Used for dictionary words indicating the word-length
|
||||||
* for font-size modification purposes
|
* for font-size modification purposes
|
||||||
*/
|
*/
|
||||||
public $maxWordLength = 6;
|
public $maxWordLength = 6;
|
||||||
|
|
||||||
/** Sessionname to store the original text */
|
/** Sessionname to store the original text */
|
||||||
public $session_var = 'tinyibcaptcha';
|
public $session_var = 'tinyibcaptcha';
|
||||||
|
|
||||||
/** Background color in RGB-array */
|
/** Background color in RGB-array */
|
||||||
public $backgroundColor = array(254, 254, 254);
|
public $backgroundColor = array(254, 254, 254);
|
||||||
|
|
||||||
/** Foreground colors in RGB-array */
|
/** Foreground colors in RGB-array */
|
||||||
public $colors = array(
|
public $colors = array(
|
||||||
array(27, 78, 181), // blue
|
array(27, 78, 181), // blue
|
||||||
array(22, 163, 35), // green
|
array(22, 163, 35), // green
|
||||||
array(214, 36, 7), // red
|
array(214, 36, 7), // red
|
||||||
);
|
);
|
||||||
|
|
||||||
/** Shadow color in RGB-array or null */
|
/** Shadow color in RGB-array or null */
|
||||||
public $shadowColor = array(0, 0, 0);
|
public $shadowColor = array(0, 0, 0);
|
||||||
|
|
||||||
/** Horizontal line through the text */
|
/** Horizontal line through the text */
|
||||||
public $lineWidth = 3;
|
public $lineWidth = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Font configuration
|
* Font configuration
|
||||||
*
|
*
|
||||||
* - font: TTF file
|
* - font: TTF file
|
||||||
* - spacing: relative pixel space between character
|
* - spacing: relative pixel space between character
|
||||||
* - minSize: min font size
|
* - minSize: min font size
|
||||||
* - maxSize: max font size
|
* - maxSize: max font size
|
||||||
*/
|
*/
|
||||||
public $fonts = array(
|
public $fonts = array(
|
||||||
'Roboto-Regular' => array('spacing' => 0, 'minSize' => 27, 'maxSize' => 27, 'font' => 'roboto_regular.ttf'),
|
'Roboto-Regular' => array('spacing' => 0, 'minSize' => 27, 'maxSize' => 27, 'font' => 'roboto_regular.ttf'),
|
||||||
'Roboto-Bold' => array('spacing' => 0, 'minSize' => 27, 'maxSize' => 27, 'font' => 'roboto_bold.ttf')
|
'Roboto-Bold' => array('spacing' => 0, 'minSize' => 27, 'maxSize' => 27, 'font' => 'roboto_bold.ttf')
|
||||||
);
|
);
|
||||||
|
|
||||||
/** Wave configuracion in X and Y axes */
|
/** Wave configuration in X and Y axes */
|
||||||
public $Yperiod = 12;
|
public $Yperiod = 12;
|
||||||
public $Yamplitude = 14;
|
public $Yamplitude = 14;
|
||||||
public $Xperiod = 11;
|
public $Xperiod = 11;
|
||||||
public $Xamplitude = 5;
|
public $Xamplitude = 5;
|
||||||
|
|
||||||
/** letter rotation clockwise */
|
/** letter rotation clockwise */
|
||||||
public $maxRotation = 8;
|
public $maxRotation = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal image size factor (for better image quality)
|
* Internal image size factor (for better image quality)
|
||||||
* 1: low, 2: medium, 3: high
|
* 1: low, 2: medium, 3: high
|
||||||
*/
|
*/
|
||||||
public $scale = 3;
|
public $scale = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blur effect for better image quality (but slower image processing).
|
* Blur effect for better image quality (but slower image processing).
|
||||||
* Better image results with scale=3
|
* Better image results with scale=3
|
||||||
*/
|
*/
|
||||||
public $blur = true;
|
public $blur = true;
|
||||||
|
|
||||||
/** Debug? */
|
/** Debug? */
|
||||||
public $debug = false;
|
public $debug = false;
|
||||||
|
|
||||||
/** Image format: jpeg or png */
|
/** Image format: jpeg or png */
|
||||||
public $imageFormat = 'png';
|
public $imageFormat = 'png';
|
||||||
|
|
||||||
/** GD image */
|
/** GD image */
|
||||||
public $im;
|
public $im;
|
||||||
|
|
||||||
public function __construct($config = array()) {
|
public function __construct($config = array()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CreateImage() {
|
public function CreateImage() {
|
||||||
$ini = microtime(true);
|
$ini = microtime(true);
|
||||||
|
|
||||||
/** Initialization */
|
/** Initialization */
|
||||||
$this->ImageAllocate();
|
$this->ImageAllocate();
|
||||||
|
|
||||||
/** Text insertion */
|
/** Text insertion */
|
||||||
$text = $this->GetCaptchaText();
|
$text = $this->GetCaptchaText();
|
||||||
$fontcfg = $this->fonts[array_rand($this->fonts)];
|
$fontcfg = $this->fonts[array_rand($this->fonts)];
|
||||||
$this->WriteText($text, $fontcfg);
|
$this->WriteText($text, $fontcfg);
|
||||||
|
|
||||||
$_SESSION[$this->session_var] = $text;
|
$_SESSION[$this->session_var] = $text;
|
||||||
|
|
||||||
/** Transformations */
|
/** Transformations */
|
||||||
if (!empty($this->lineWidth)) {
|
if (!empty($this->lineWidth)) {
|
||||||
$this->WriteLine();
|
$this->WriteLine();
|
||||||
}
|
}
|
||||||
$this->WaveImage();
|
$this->WaveImage();
|
||||||
if ($this->blur && function_exists('imagefilter')) {
|
if ($this->blur && function_exists('imagefilter')) {
|
||||||
imagefilter($this->im, IMG_FILTER_GAUSSIAN_BLUR);
|
imagefilter($this->im, IMG_FILTER_GAUSSIAN_BLUR);
|
||||||
}
|
}
|
||||||
$this->ReduceImage();
|
$this->ReduceImage();
|
||||||
|
|
||||||
if ($this->debug) {
|
if ($this->debug) {
|
||||||
imagestring($this->im, 1, 1, $this->height - 8,
|
imagestring($this->im, 1, 1, $this->height - 8,
|
||||||
"$text {$fontcfg['font']} " . round((microtime(true) - $ini) * 1000) . "ms",
|
"$text {$fontcfg['font']} " . round((microtime(true) - $ini) * 1000) . "ms",
|
||||||
$this->GdFgColor
|
$this->GdFgColor
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Output */
|
/** Output */
|
||||||
$this->WriteImage();
|
$this->WriteImage();
|
||||||
$this->Cleanup();
|
$this->Cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the image resources
|
* Creates the image resources
|
||||||
*/
|
*/
|
||||||
protected function ImageAllocate() {
|
protected function ImageAllocate() {
|
||||||
// Cleanup
|
// Cleanup
|
||||||
if (!empty($this->im)) {
|
if (!empty($this->im)) {
|
||||||
imagedestroy($this->im);
|
imagedestroy($this->im);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->im = imagecreatetruecolor($this->width * $this->scale, $this->height * $this->scale);
|
$this->im = imagecreatetruecolor($this->width * $this->scale, $this->height * $this->scale);
|
||||||
|
|
||||||
// Background color
|
// Background color
|
||||||
$this->GdBgColor = imagecolorallocate($this->im,
|
$this->GdBgColor = imagecolorallocate($this->im,
|
||||||
$this->backgroundColor[0],
|
$this->backgroundColor[0],
|
||||||
$this->backgroundColor[1],
|
$this->backgroundColor[1],
|
||||||
$this->backgroundColor[2]
|
$this->backgroundColor[2]
|
||||||
);
|
);
|
||||||
imagefilledrectangle($this->im, 0, 0, $this->width * $this->scale, $this->height * $this->scale, $this->GdBgColor);
|
imagefilledrectangle($this->im, 0, 0, $this->width * $this->scale, $this->height * $this->scale, $this->GdBgColor);
|
||||||
|
|
||||||
// Foreground color
|
// Foreground color
|
||||||
$color = $this->colors[mt_rand(0, sizeof($this->colors) - 1)];
|
$color = $this->colors[mt_rand(0, sizeof($this->colors) - 1)];
|
||||||
$this->GdFgColor = imagecolorallocate($this->im, $color[0], $color[1], $color[2]);
|
$this->GdFgColor = imagecolorallocate($this->im, $color[0], $color[1], $color[2]);
|
||||||
|
|
||||||
// Shadow color
|
// Shadow color
|
||||||
if (!empty($this->shadowColor) && is_array($this->shadowColor) && sizeof($this->shadowColor) >= 3) {
|
if (!empty($this->shadowColor) && is_array($this->shadowColor) && sizeof($this->shadowColor) >= 3) {
|
||||||
$this->GdShadowColor = imagecolorallocate($this->im,
|
$this->GdShadowColor = imagecolorallocate($this->im,
|
||||||
$this->shadowColor[0],
|
$this->shadowColor[0],
|
||||||
$this->shadowColor[1],
|
$this->shadowColor[1],
|
||||||
$this->shadowColor[2]
|
$this->shadowColor[2]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Text generation
|
* Text generation
|
||||||
*
|
*
|
||||||
* @return string Text
|
* @return string Text
|
||||||
*/
|
*/
|
||||||
protected function GetCaptchaText() {
|
protected function GetCaptchaText() {
|
||||||
$text = $this->GetDictionaryCaptchaText();
|
$text = $this->GetDictionaryCaptchaText();
|
||||||
if (!$text) {
|
if (!$text) {
|
||||||
$text = $this->GetRandomCaptchaText();
|
$text = $this->GetRandomCaptchaText();
|
||||||
}
|
}
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Random text generation
|
* Random text generation
|
||||||
*
|
*
|
||||||
* @return string Text
|
* @return string Text
|
||||||
*/
|
*/
|
||||||
protected function GetRandomCaptchaText($length = null) {
|
protected function GetRandomCaptchaText($length = null) {
|
||||||
if (empty($length)) {
|
if (empty($length)) {
|
||||||
$length = rand($this->minWordLength, $this->maxWordLength);
|
$length = rand($this->minWordLength, $this->maxWordLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
$words = "abcdefghijlmnopqrstvwyz";
|
$words = "abcdefghijlmnopqrstvwyz";
|
||||||
$vocals = "aeiou";
|
$vocals = "aeiou";
|
||||||
|
|
||||||
$text = "";
|
$text = "";
|
||||||
$vocal = rand(0, 1);
|
$vocal = rand(0, 1);
|
||||||
for ($i = 0; $i < $length; $i++) {
|
for ($i = 0; $i < $length; $i++) {
|
||||||
if ($vocal) {
|
if ($vocal) {
|
||||||
$text .= substr($vocals, mt_rand(0, 4), 1);
|
$text .= substr($vocals, mt_rand(0, 4), 1);
|
||||||
} else {
|
} else {
|
||||||
$text .= substr($words, mt_rand(0, 22), 1);
|
$text .= substr($words, mt_rand(0, 22), 1);
|
||||||
}
|
}
|
||||||
$vocal = !$vocal;
|
$vocal = !$vocal;
|
||||||
}
|
}
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Random dictionary word generation
|
* Random dictionary word generation
|
||||||
*
|
*
|
||||||
* @param boolean $extended Add extended "fake" words
|
* @param boolean $extended Add extended "fake" words
|
||||||
* @return string Word
|
* @return string Word
|
||||||
*/
|
*/
|
||||||
function GetDictionaryCaptchaText($extended = false) {
|
function GetDictionaryCaptchaText($extended = false) {
|
||||||
if (empty($this->wordsFile)) {
|
if (empty($this->wordsFile)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Full path of words file
|
// Full path of words file
|
||||||
if (substr($this->wordsFile, 0, 1) == '/') {
|
if (substr($this->wordsFile, 0, 1) == '/') {
|
||||||
$wordsfile = $this->wordsFile;
|
$wordsfile = $this->wordsFile;
|
||||||
} else {
|
} else {
|
||||||
$wordsfile = $this->resourcesPath . '/' . $this->wordsFile;
|
$wordsfile = $this->resourcesPath . '/' . $this->wordsFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_exists($wordsfile)) {
|
if (!file_exists($wordsfile)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fp = fopen($wordsfile, "r");
|
$fp = fopen($wordsfile, "r");
|
||||||
$length = strlen(fgets($fp));
|
$length = strlen(fgets($fp));
|
||||||
if (!$length) {
|
if (!$length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$line = rand(1, (filesize($wordsfile) / $length) - 2);
|
$line = rand(1, (filesize($wordsfile) / $length) - 2);
|
||||||
if (fseek($fp, $length * $line) == -1) {
|
if (fseek($fp, $length * $line) == -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$text = trim(fgets($fp));
|
$text = trim(fgets($fp));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
/** Change ramdom volcals */
|
/** Change random volcals */
|
||||||
if ($extended) {
|
if ($extended) {
|
||||||
$text = preg_split('//', $text, -1, PREG_SPLIT_NO_EMPTY);
|
$text = preg_split('//', $text, -1, PREG_SPLIT_NO_EMPTY);
|
||||||
$vocals = array('a', 'e', 'i', 'o', 'u');
|
$vocals = array('a', 'e', 'i', 'o', 'u');
|
||||||
foreach ($text as $i => $char) {
|
foreach ($text as $i => $char) {
|
||||||
if (mt_rand(0, 1) && in_array($char, $vocals)) {
|
if (mt_rand(0, 1) && in_array($char, $vocals)) {
|
||||||
$text[$i] = $vocals[mt_rand(0, 4)];
|
$text[$i] = $vocals[mt_rand(0, 4)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$text = implode('', $text);
|
$text = implode('', $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Horizontal line insertion
|
* Horizontal line insertion
|
||||||
*/
|
*/
|
||||||
protected function WriteLine() {
|
protected function WriteLine() {
|
||||||
$x1 = $this->width * $this->scale * .15;
|
$x1 = $this->width * $this->scale * .15;
|
||||||
$x2 = $this->textFinalX;
|
$x2 = $this->textFinalX;
|
||||||
$y1 = rand($this->height * $this->scale * .40, $this->height * $this->scale * .65);
|
$y1 = rand($this->height * $this->scale * .40, $this->height * $this->scale * .65);
|
||||||
$y2 = rand($this->height * $this->scale * .40, $this->height * $this->scale * .65);
|
$y2 = rand($this->height * $this->scale * .40, $this->height * $this->scale * .65);
|
||||||
$width = $this->lineWidth / 2 * $this->scale;
|
$width = $this->lineWidth / 2 * $this->scale;
|
||||||
|
|
||||||
for ($i = $width * -1; $i <= $width; $i++) {
|
for ($i = $width * -1; $i <= $width; $i++) {
|
||||||
imageline($this->im, $x1, $y1 + $i, $x2, $y2 + $i, $this->GdFgColor);
|
imageline($this->im, $x1, $y1 + $i, $x2, $y2 + $i, $this->GdFgColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Text insertion
|
* Text insertion
|
||||||
*/
|
*/
|
||||||
protected function WriteText($text, $fontcfg = array()) {
|
protected function WriteText($text, $fontcfg = array()) {
|
||||||
if (empty($fontcfg)) {
|
if (empty($fontcfg)) {
|
||||||
// Select the font configuration
|
// Select the font configuration
|
||||||
$fontcfg = $this->fonts[array_rand($this->fonts)];
|
$fontcfg = $this->fonts[array_rand($this->fonts)];
|
||||||
}
|
}
|
||||||
|
|
||||||
$fontfile = $fontcfg['font'];
|
$fontfile = $fontcfg['font'];
|
||||||
|
|
||||||
/** Increase font-size for shortest words: 9% for each glyph missing */
|
/** Increase font-size for shortest words: 9% for each glyph missing */
|
||||||
$lettersMissing = $this->maxWordLength - strlen($text);
|
$lettersMissing = $this->maxWordLength - strlen($text);
|
||||||
$fontSizefactor = 1 + ($lettersMissing * 0.09);
|
$fontSizefactor = 1 + ($lettersMissing * 0.09);
|
||||||
|
|
||||||
// Text generation (char by char)
|
// Text generation (char by char)
|
||||||
$x = 20 * $this->scale;
|
$x = 20 * $this->scale;
|
||||||
$y = round(($this->height * 27 / 40) * $this->scale);
|
$y = round(($this->height * 27 / 40) * $this->scale);
|
||||||
$length = strlen($text);
|
$length = strlen($text);
|
||||||
for ($i = 0; $i < $length; $i++) {
|
for ($i = 0; $i < $length; $i++) {
|
||||||
$degree = rand($this->maxRotation * -1, $this->maxRotation);
|
$degree = rand($this->maxRotation * -1, $this->maxRotation);
|
||||||
$fontsize = rand($fontcfg['minSize'], $fontcfg['maxSize']) * $this->scale * $fontSizefactor;
|
$fontsize = rand($fontcfg['minSize'], $fontcfg['maxSize']) * $this->scale * $fontSizefactor;
|
||||||
$letter = substr($text, $i, 1);
|
$letter = substr($text, $i, 1);
|
||||||
|
|
||||||
if ($this->shadowColor) {
|
if ($this->shadowColor) {
|
||||||
$coords = imagettftext($this->im, $fontsize, $degree,
|
$coords = imagettftext($this->im, $fontsize, $degree,
|
||||||
$x + $this->scale, $y + $this->scale,
|
$x + $this->scale, $y + $this->scale,
|
||||||
$this->GdShadowColor, $fontfile, $letter);
|
$this->GdShadowColor, $fontfile, $letter);
|
||||||
}
|
}
|
||||||
$coords = imagettftext($this->im, $fontsize, $degree,
|
$coords = imagettftext($this->im, $fontsize, $degree,
|
||||||
$x, $y,
|
$x, $y,
|
||||||
$this->GdFgColor, $fontfile, $letter);
|
$this->GdFgColor, $fontfile, $letter);
|
||||||
$x += ($coords[2] - $x) + ($fontcfg['spacing'] * $this->scale);
|
$x += ($coords[2] - $x) + ($fontcfg['spacing'] * $this->scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->textFinalX = $x;
|
$this->textFinalX = $x;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wave filter
|
* Wave filter
|
||||||
*/
|
*/
|
||||||
protected function WaveImage() {
|
protected function WaveImage() {
|
||||||
// X-axis wave generation
|
// X-axis wave generation
|
||||||
$xp = $this->scale * $this->Xperiod * rand(1, 3);
|
$xp = $this->scale * $this->Xperiod * rand(1, 3);
|
||||||
$k = rand(0, 100);
|
$k = rand(0, 100);
|
||||||
for ($i = 0; $i < ($this->width * $this->scale); $i++) {
|
for ($i = 0; $i < ($this->width * $this->scale); $i++) {
|
||||||
imagecopy($this->im, $this->im,
|
imagecopy($this->im, $this->im,
|
||||||
$i - 1, sin($k + $i / $xp) * ($this->scale * $this->Xamplitude),
|
$i - 1, sin($k + $i / $xp) * ($this->scale * $this->Xamplitude),
|
||||||
$i, 0, 1, $this->height * $this->scale);
|
$i, 0, 1, $this->height * $this->scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Y-axis wave generation
|
// Y-axis wave generation
|
||||||
$k = rand(0, 100);
|
$k = rand(0, 100);
|
||||||
$yp = $this->scale * $this->Yperiod * rand(1, 2);
|
$yp = $this->scale * $this->Yperiod * rand(1, 2);
|
||||||
for ($i = 0; $i < ($this->height * $this->scale); $i++) {
|
for ($i = 0; $i < ($this->height * $this->scale); $i++) {
|
||||||
imagecopy($this->im, $this->im,
|
imagecopy($this->im, $this->im,
|
||||||
sin($k + $i / $yp) * ($this->scale * $this->Yamplitude), $i - 1,
|
sin($k + $i / $yp) * ($this->scale * $this->Yamplitude), $i - 1,
|
||||||
0, $i, $this->width * $this->scale, 1);
|
0, $i, $this->width * $this->scale, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reduce the image to the final size
|
* Reduce the image to the final size
|
||||||
*/
|
*/
|
||||||
protected function ReduceImage() {
|
protected function ReduceImage() {
|
||||||
// Reduzco el tama<6D>o de la imagen
|
// Reduzco el tama<6D>o de la imagen
|
||||||
$imResampled = imagecreatetruecolor($this->width, $this->height);
|
$imResampled = imagecreatetruecolor($this->width, $this->height);
|
||||||
imagecopyresampled($imResampled, $this->im,
|
imagecopyresampled($imResampled, $this->im,
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
$this->width, $this->height,
|
$this->width, $this->height,
|
||||||
$this->width * $this->scale, $this->height * $this->scale
|
$this->width * $this->scale, $this->height * $this->scale
|
||||||
);
|
);
|
||||||
imagedestroy($this->im);
|
imagedestroy($this->im);
|
||||||
$this->im = $imResampled;
|
$this->im = $imResampled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File generation
|
* File generation
|
||||||
*/
|
*/
|
||||||
protected function WriteImage() {
|
protected function WriteImage() {
|
||||||
if ($this->imageFormat == 'png' && function_exists('imagepng')) {
|
if ($this->imageFormat == 'png' && function_exists('imagepng')) {
|
||||||
imagealphablending($this->im, true);
|
imagealphablending($this->im, true);
|
||||||
imagesavealpha($this->im, false);
|
imagesavealpha($this->im, false);
|
||||||
imagecolortransparent($this->im, $this->GdBgColor);
|
imagecolortransparent($this->im, $this->GdBgColor);
|
||||||
|
|
||||||
header("Content-type: image/png");
|
header("Content-type: image/png");
|
||||||
imagepng($this->im);
|
imagepng($this->im);
|
||||||
} else {
|
} else {
|
||||||
header("Content-type: image/jpeg");
|
header("Content-type: image/jpeg");
|
||||||
imagejpeg($this->im, null, 80);
|
imagejpeg($this->im, null, 80);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleanup
|
* Cleanup
|
||||||
*/
|
*/
|
||||||
protected function Cleanup() {
|
protected function Cleanup() {
|
||||||
imagedestroy($this->im);
|
imagedestroy($this->im);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -701,7 +701,6 @@ EOF;
|
|||||||
|
|
||||||
$post_html = '';
|
$post_html = '';
|
||||||
$posts = latestPosts(true);
|
$posts = latestPosts(true);
|
||||||
$i = 0;
|
|
||||||
foreach ($posts as $post) {
|
foreach ($posts as $post) {
|
||||||
if ($post_html != '') {
|
if ($post_html != '') {
|
||||||
$post_html .= '<tr><td colspan="2"><hr></td></tr>';
|
$post_html .= '<tr><td colspan="2"><hr></td></tr>';
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#
|
#
|
||||||
# Contact the author via tslocum@gmail.com if you need support.
|
# Contact the author via tslocum@gmail.com if you need support.
|
||||||
# See README for instructions on configuring, moderating and upgrading your board.
|
# See README for instructions on configuring, moderating and upgrading your board.
|
||||||
|
#
|
||||||
# Set TINYIB_DBMODE to a MySQL-related mode if it's available. By default it's set to flatfile, which can be very slow.
|
# Set TINYIB_DBMODE to a MySQL-related mode if it's available. By default it's set to flatfile, which can be very slow.
|
||||||
|
|
||||||
// Administrator/moderator credentials
|
// Administrator/moderator credentials
|
||||||
@ -70,4 +71,4 @@ define('TINYIB_DBNAME', ""); // Database
|
|||||||
define('TINYIB_DBDRIVER', "mysql"); // PDO driver to use (mysql / sqlite / pgsql / etc.)
|
define('TINYIB_DBDRIVER', "mysql"); // PDO driver to use (mysql / sqlite / pgsql / etc.)
|
||||||
define('TINYIB_DBDSN', ""); // Enter a custom DSN to override all of the connection/driver settings above (see README for instructions)
|
define('TINYIB_DBDSN', ""); // Enter a custom DSN to override all of the connection/driver settings above (see README for instructions)
|
||||||
// When changing this, you should still set TINYIB_DBDRIVER appropriately.
|
// When changing this, you should still set TINYIB_DBDRIVER appropriately.
|
||||||
// If you're using PDO with MySQL, you should leave this blank so TinyIB can build the DSN.
|
// If you're using PDO with a MySQL database, you should leave this blank.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user