https a bunch of things
This commit is contained in:
parent
c3b67f346b
commit
03806d0420
25 changed files with 63 additions and 63 deletions
|
@ -30,12 +30,12 @@
|
||||||
|
|
||||||
Email: webmaster at shishnet.org
|
Email: webmaster at shishnet.org
|
||||||
|
|
||||||
Issue/Bug tracker: http://github.com/shish/shimmie2/issues
|
Issue/Bug tracker: https://github.com/shish/shimmie2/issues
|
||||||
|
|
||||||
|
|
||||||
# Licence
|
# Licence
|
||||||
|
|
||||||
All code is released under the [GNU GPL Version 2](http://www.gnu.org/licenses/gpl-2.0.html) unless mentioned otherwise.
|
All code is released under the [GNU GPL Version 2](https://www.gnu.org/licenses/gpl-2.0.html) unless mentioned otherwise.
|
||||||
|
|
||||||
If you give shimmie to someone else, you have to give them the source (which
|
If you give shimmie to someone else, you have to give them the source (which
|
||||||
should be easy, as PHP is an interpreted language...). If you want to add
|
should be easy, as PHP is an interpreted language...). If you want to add
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* Also loads the theme object into $this->theme if available
|
* Also loads the theme object into $this->theme if available
|
||||||
*
|
*
|
||||||
* The original concept came from Artanis's Extension extension
|
* The original concept came from Artanis's Extension extension
|
||||||
* --> http://github.com/Artanis/simple-extension/tree/master
|
* --> https://github.com/Artanis/simple-extension/tree/master
|
||||||
* Then re-implemented by Shish after he broke the forum and couldn't
|
* Then re-implemented by Shish after he broke the forum and couldn't
|
||||||
* find the thread where the original was posted >_<
|
* find the thread where the original was posted >_<
|
||||||
*/
|
*/
|
||||||
|
@ -115,7 +115,7 @@ abstract class ExtensionInfo
|
||||||
// Every credit you get costs us RAM. It stops now.
|
// Every credit you get costs us RAM. It stops now.
|
||||||
public const SHISH_NAME = "Shish";
|
public const SHISH_NAME = "Shish";
|
||||||
public const SHISH_EMAIL = "webmaster@shishnet.org";
|
public const SHISH_EMAIL = "webmaster@shishnet.org";
|
||||||
public const SHIMMIE_URL = "http://code.shishnet.org/shimmie2/";
|
public const SHIMMIE_URL = "https://code.shishnet.org/shimmie2/";
|
||||||
public const SHISH_AUTHOR = [self::SHISH_NAME=>self::SHISH_EMAIL];
|
public const SHISH_AUTHOR = [self::SHISH_NAME=>self::SHISH_EMAIL];
|
||||||
|
|
||||||
public const LICENSE_GPLV2 = "GPLv2";
|
public const LICENSE_GPLV2 = "GPLv2";
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
* @package Shimmie
|
* @package Shimmie
|
||||||
* @copyright Copyright (c) 2007-2015, Shish et al.
|
* @copyright Copyright (c) 2007-2015, Shish et al.
|
||||||
* @author Shish [webmaster at shishnet.org], jgen [jeffgenovy at gmail.com]
|
* @author Shish [webmaster at shishnet.org], jgen [jeffgenovy at gmail.com]
|
||||||
* @link http://code.shishnet.org/shimmie2/
|
* @link https://code.shishnet.org/shimmie2/
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
* @license https://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
*
|
*
|
||||||
* Initialise the database, check that folder
|
* Initialise the database, check that folder
|
||||||
* permissions are set properly.
|
* permissions are set properly.
|
||||||
|
|
|
@ -27,7 +27,7 @@ function array_iunique(array $array): array
|
||||||
/**
|
/**
|
||||||
* Figure out if an IP is in a specified range
|
* Figure out if an IP is in a specified range
|
||||||
*
|
*
|
||||||
* from http://uk.php.net/network
|
* from https://uk.php.net/network
|
||||||
*/
|
*/
|
||||||
function ip_in_range(string $IP, string $CIDR): bool
|
function ip_in_range(string $IP, string $CIDR): bool
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ function deltree(string $f): void
|
||||||
/**
|
/**
|
||||||
* Copy an entire file hierarchy
|
* Copy an entire file hierarchy
|
||||||
*
|
*
|
||||||
* from a comment on http://uk.php.net/copy
|
* from a comment on https://uk.php.net/copy
|
||||||
*/
|
*/
|
||||||
function full_copy(string $source, string $target): void
|
function full_copy(string $source, string $target): void
|
||||||
{
|
{
|
||||||
|
@ -380,7 +380,7 @@ function zglob(string $pattern): array
|
||||||
/**
|
/**
|
||||||
* Figure out the path to the shimmie install directory.
|
* Figure out the path to the shimmie install directory.
|
||||||
*
|
*
|
||||||
* eg if shimmie is visible at http://foo.com/gallery, this
|
* eg if shimmie is visible at https://foo.com/gallery, this
|
||||||
* function should return /gallery
|
* function should return /gallery
|
||||||
*
|
*
|
||||||
* PHP really, really sucks.
|
* PHP really, really sucks.
|
||||||
|
@ -478,7 +478,7 @@ function bool_escape($input): bool
|
||||||
Sometimes, I don't like PHP -- this, is one of those times...
|
Sometimes, I don't like PHP -- this, is one of those times...
|
||||||
"a boolean FALSE is not considered a valid boolean value by this function."
|
"a boolean FALSE is not considered a valid boolean value by this function."
|
||||||
Yay for Got'chas!
|
Yay for Got'chas!
|
||||||
http://php.net/manual/en/filter.filters.validate.php
|
https://php.net/manual/en/filter.filters.validate.php
|
||||||
*/
|
*/
|
||||||
if (is_bool($input)) {
|
if (is_bool($input)) {
|
||||||
return $input;
|
return $input;
|
||||||
|
|
|
@ -101,7 +101,7 @@ function send_event(Event $event): Event
|
||||||
if ($tracer_enabled) {
|
if ($tracer_enabled) {
|
||||||
$_tracer->begin(get_class($event));
|
$_tracer->begin(get_class($event));
|
||||||
}
|
}
|
||||||
// SHIT: http://bugs.php.net/bug.php?id=35106
|
// SHIT: https://bugs.php.net/bug.php?id=35106
|
||||||
$my_event_listeners = $_shm_event_listeners[get_class($event)];
|
$my_event_listeners = $_shm_event_listeners[get_class($event)];
|
||||||
ksort($my_event_listeners);
|
ksort($my_event_listeners);
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,8 @@ class UrlsTest extends TestCase
|
||||||
|
|
||||||
// absolute
|
// absolute
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
"http://foo.com",
|
"https://foo.com",
|
||||||
make_http("http://foo.com")
|
make_http("https://foo.com")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ function get_memory_limit(): int
|
||||||
Get PHP's configured memory limit.
|
Get PHP's configured memory limit.
|
||||||
Note that this is set to -1 for NO memory limit.
|
Note that this is set to -1 for NO memory limit.
|
||||||
|
|
||||||
http://ca2.php.net/manual/en/ini.core.php#ini.memory-limit
|
https://ca2.php.net/manual/en/ini.core.php#ini.memory-limit
|
||||||
*/
|
*/
|
||||||
$memory = parse_shorthand_int(ini_get("memory_limit"));
|
$memory = parse_shorthand_int(ini_get("memory_limit"));
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class BBCodeInfo extends ExtensionInfo
|
||||||
" Supported tags:
|
" Supported tags:
|
||||||
<ul>
|
<ul>
|
||||||
<li>[img]url[/img]
|
<li>[img]url[/img]
|
||||||
<li>[url]<a href=\"{self::SHIMMIE_URL}\">http://code.shishnet.org/</a>[/url]
|
<li>[url]<a href=\"{self::SHIMMIE_URL}\">https://code.shishnet.org/</a>[/url]
|
||||||
<li>[email]<a href=\"mailto:{self::SHISH_EMAIL}\">webmaster@shishnet.org</a>[/email]
|
<li>[email]<a href=\"mailto:{self::SHISH_EMAIL}\">webmaster@shishnet.org</a>[/email]
|
||||||
<li>[b]<b>bold</b>[/b]
|
<li>[b]<b>bold</b>[/b]
|
||||||
<li>[i]<i>italic</i>[/i]
|
<li>[i]<i>italic</i>[/i]
|
||||||
|
|
|
@ -67,12 +67,12 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
|
||||||
public function testURL()
|
public function testURL()
|
||||||
{
|
{
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$this->filter("[url]http://shishnet.org[/url]"),
|
$this->filter("[url]https://shishnet.org[/url]"),
|
||||||
"<a href=\"http://shishnet.org\">http://shishnet.org</a>"
|
"<a href=\"https://shishnet.org\">https://shishnet.org</a>"
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$this->filter("[url=http://shishnet.org]ShishNet[/url]"),
|
$this->filter("[url=https://shishnet.org]ShishNet[/url]"),
|
||||||
"<a href=\"http://shishnet.org\">ShishNet</a>"
|
"<a href=\"https://shishnet.org\">ShishNet</a>"
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$this->filter("[url=javascript:alert(\"owned\")]click to fail[/url]"),
|
$this->filter("[url=javascript:alert(\"owned\")]click to fail[/url]"),
|
||||||
|
|
|
@ -12,5 +12,5 @@ class BlotterInfo extends ExtensionInfo
|
||||||
public $description = "Displays brief updates about whatever you want on every page.
|
public $description = "Displays brief updates about whatever you want on every page.
|
||||||
Colors and positioning can be configured to match your site's design.
|
Colors and positioning can be configured to match your site's design.
|
||||||
|
|
||||||
Development TODO at http://github.com/zshall/shimmie2/issues";
|
Development TODO at https://github.com/zshall/shimmie2/issues";
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@ class DanbooruApi extends Extension
|
||||||
|
|
||||||
// Hackery for danbooruup 0.3.2 providing the wrong view url. This simply redirects to the proper
|
// Hackery for danbooruup 0.3.2 providing the wrong view url. This simply redirects to the proper
|
||||||
// Shimmie view page
|
// Shimmie view page
|
||||||
// Example: danbooruup says the url is http://shimmie/api/danbooru/post/show/123
|
// Example: danbooruup says the url is https://shimmie/api/danbooru/post/show/123
|
||||||
// This redirects that to http://shimmie/post/view/123
|
// This redirects that to https://shimmie/post/view/123
|
||||||
elseif ($event->page_matches("api/danbooru/post/show")) {
|
elseif ($event->page_matches("api/danbooru/post/show")) {
|
||||||
$fixedlocation = make_link("post/view/" . $event->get_arg(0));
|
$fixedlocation = make_link("post/view/" . $event->get_arg(0));
|
||||||
$page->set_mode(PageMode::REDIRECT);
|
$page->set_mode(PageMode::REDIRECT);
|
||||||
|
|
|
@ -20,7 +20,7 @@ class VideoFileHandlerTheme extends Themelet
|
||||||
if (array_key_exists($ext, $supportedExts)) {
|
if (array_key_exists($ext, $supportedExts)) {
|
||||||
//FLV isn't supported by <video>, but it should always fallback to the flash-based method.
|
//FLV isn't supported by <video>, but it should always fallback to the flash-based method.
|
||||||
if ($ext == "webm") {
|
if ($ext == "webm") {
|
||||||
//Several browsers still lack WebM support sadly: http://caniuse.com/#feat=webm
|
//Several browsers still lack WebM support sadly: https://caniuse.com/#feat=webm
|
||||||
$html .= "<!--[if IE]><p>To view webm files with IE, please <a href='https://tools.google.com/dlpage/webmmf/' target='_blank'>download this plugin</a>.</p><![endif]-->";
|
$html .= "<!--[if IE]><p>To view webm files with IE, please <a href='https://tools.google.com/dlpage/webmmf/' target='_blank'>download this plugin</a>.</p><![endif]-->";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ EOD
|
||||||
<div class='space' id='foot'>
|
<div class='space' id='foot'>
|
||||||
<small><small>
|
<small><small>
|
||||||
$contact_link Serving $num_comma posts –
|
$contact_link Serving $num_comma posts –
|
||||||
Running <a href='http://code.shishnet.org/shimmie2/'>Shimmie2</a>
|
Running <a href='https://code.shishnet.org/shimmie2/'>Shimmie2</a>
|
||||||
</small></small>
|
</small></small>
|
||||||
</div>
|
</div>
|
||||||
</div>";
|
</div>";
|
||||||
|
|
|
@ -15,7 +15,7 @@ class LinkImageTheme extends Themelet
|
||||||
<table><tr>
|
<table><tr>
|
||||||
|
|
||||||
<td><fieldset>
|
<td><fieldset>
|
||||||
<legend><a href='http://en.wikipedia.org/wiki/Bbcode' target='_blank'>BBCode</a></legend>
|
<legend><a href='https://en.wikipedia.org/wiki/Bbcode' target='_blank'>BBCode</a></legend>
|
||||||
<table>
|
<table>
|
||||||
".
|
".
|
||||||
$this->link_code("Link", $this->url($post_link, $text_link, "ubb"), "ubb_text-link").
|
$this->link_code("Link", $this->url($post_link, $text_link, "ubb"), "ubb_text-link").
|
||||||
|
@ -26,7 +26,7 @@ class LinkImageTheme extends Themelet
|
||||||
</fieldset></td>
|
</fieldset></td>
|
||||||
|
|
||||||
<td><fieldset>
|
<td><fieldset>
|
||||||
<legend><a href='http://en.wikipedia.org/wiki/Html' target='_blank'>HTML</a></legend>
|
<legend><a href='https://en.wikipedia.org/wiki/Html' target='_blank'>HTML</a></legend>
|
||||||
<table>
|
<table>
|
||||||
".
|
".
|
||||||
$this->link_code("Link", $this->url($post_link, $text_link, "html"), "html_text-link").
|
$this->link_code("Link", $this->url($post_link, $text_link, "html"), "html_text-link").
|
||||||
|
|
|
@ -321,7 +321,7 @@ class Media extends Extension
|
||||||
* We need to consider the size that we are GOING TO instead.
|
* We need to consider the size that we are GOING TO instead.
|
||||||
*
|
*
|
||||||
* The factor of 2.5 is simply a rough guideline.
|
* The factor of 2.5 is simply a rough guideline.
|
||||||
* http://stackoverflow.com/questions/527532/reasonable-php-memory-limit-for-image-resize
|
* https://stackoverflow.com/questions/527532/reasonable-php-memory-limit-for-image-resize
|
||||||
*
|
*
|
||||||
* @param array $info The output of getimagesize() for the source file in question.
|
* @param array $info The output of getimagesize() for the source file in question.
|
||||||
* @return int The number of bytes an image resize operation is estimated to use.
|
* @return int The number of bytes an image resize operation is estimated to use.
|
||||||
|
@ -741,7 +741,7 @@ class Media extends Extension
|
||||||
case IMAGETYPE_PNG:
|
case IMAGETYPE_PNG:
|
||||||
case IMAGETYPE_WEBP:
|
case IMAGETYPE_WEBP:
|
||||||
//
|
//
|
||||||
// More info here: http://stackoverflow.com/questions/279236/how-do-i-resize-pngs-with-transparency-in-php
|
// More info here: https://stackoverflow.com/questions/279236/how-do-i-resize-pngs-with-transparency-in-php
|
||||||
//
|
//
|
||||||
if (imagealphablending($image_resized, false) === false) {
|
if (imagealphablending($image_resized, false) === false) {
|
||||||
throw new MediaException("Unable to disable image alpha blending");
|
throw new MediaException("Unable to disable image alpha blending");
|
||||||
|
@ -816,7 +816,7 @@ class Media extends Extension
|
||||||
$is_anim_gif = 0;
|
$is_anim_gif = 0;
|
||||||
if (($fh = @fopen($image_filename, 'rb'))) {
|
if (($fh = @fopen($image_filename, 'rb'))) {
|
||||||
try {
|
try {
|
||||||
//check if gif is animated (via http://www.php.net/manual/en/function.imagecreatefromgif.php#104473)
|
//check if gif is animated (via https://www.php.net/manual/en/function.imagecreatefromgif.php#104473)
|
||||||
while (!feof($fh) && $is_anim_gif < 2) {
|
while (!feof($fh) && $is_anim_gif < 2) {
|
||||||
$chunk = fread($fh, 1024 * 100);
|
$chunk = fread($fh, 1024 * 100);
|
||||||
$is_anim_gif += preg_match_all('#\x00\x21\xF9\x04.{4}\x00[\x2C\x21]#s', $chunk, $matches);
|
$is_anim_gif += preg_match_all('#\x00\x21\xF9\x04.{4}\x00[\x2C\x21]#s', $chunk, $matches);
|
||||||
|
|
|
@ -87,7 +87,7 @@ class ResizeImage extends Extension
|
||||||
if ($image_obj->ext == "gif") {
|
if ($image_obj->ext == "gif") {
|
||||||
$image_filename = warehouse_path(Image::IMAGE_DIR, $image_obj->hash);
|
$image_filename = warehouse_path(Image::IMAGE_DIR, $image_obj->hash);
|
||||||
if (($fh = @fopen($image_filename, 'rb'))) {
|
if (($fh = @fopen($image_filename, 'rb'))) {
|
||||||
//check if gif is animated (via http://www.php.net/manual/en/function.imagecreatefromgif.php#104473)
|
//check if gif is animated (via https://www.php.net/manual/en/function.imagecreatefromgif.php#104473)
|
||||||
while (!feof($fh) && $isanigif < 2) {
|
while (!feof($fh) && $isanigif < 2) {
|
||||||
$chunk = fread($fh, 1024 * 100);
|
$chunk = fread($fh, 1024 * 100);
|
||||||
$isanigif += preg_match_all('#\x00\x21\xF9\x04.{4}\x00[\x2C\x21]#s', $chunk, $matches);
|
$isanigif += preg_match_all('#\x00\x21\xF9\x04.{4}\x00[\x2C\x21]#s', $chunk, $matches);
|
||||||
|
|
|
@ -379,7 +379,7 @@ class Setup extends Extension
|
||||||
$event->panel->add_block($sb);
|
$event->panel->add_block($sb);
|
||||||
|
|
||||||
$sb = new SetupBlock("Remote API Integration");
|
$sb = new SetupBlock("Remote API Integration");
|
||||||
$sb->add_label("<a href='http://akismet.com/'>Akismet</a>");
|
$sb->add_label("<a href='https://akismet.com/'>Akismet</a>");
|
||||||
$sb->add_text_option("comment_wordpress_key", "<br>API key: ");
|
$sb->add_text_option("comment_wordpress_key", "<br>API key: ");
|
||||||
$sb->add_label("<br> <br><a href='https://www.google.com/recaptcha/admin'>ReCAPTCHA</a>");
|
$sb->add_label("<br> <br><a href='https://www.google.com/recaptcha/admin'>ReCAPTCHA</a>");
|
||||||
$sb->add_text_option("api_recaptcha_privkey", "<br>Secret key: ");
|
$sb->add_text_option("api_recaptcha_privkey", "<br>Secret key: ");
|
||||||
|
|
|
@ -395,8 +395,8 @@ class SourceHistory extends Extension
|
||||||
MySQL does NOT allow you to modify the same table which you use in the SELECT part.
|
MySQL does NOT allow you to modify the same table which you use in the SELECT part.
|
||||||
Which means that these will probably have to stay as TWO separate queries...
|
Which means that these will probably have to stay as TWO separate queries...
|
||||||
|
|
||||||
http://dev.mysql.com/doc/refman/5.1/en/subquery-restrictions.html
|
https://dev.mysql.com/doc/refman/5.1/en/subquery-restrictions.html
|
||||||
http://stackoverflow.com/questions/45494/mysql-error-1093-cant-specify-target-table-for-update-in-from-clause
|
https://stackoverflow.com/questions/45494/mysql-error-1093-cant-specify-target-table-for-update-in-from-clause
|
||||||
*/
|
*/
|
||||||
$min_id = $database->get_one("SELECT MIN(id) FROM source_histories WHERE image_id = :image_id", ["image_id"=>$image->id]);
|
$min_id = $database->get_one("SELECT MIN(id) FROM source_histories WHERE image_id = :image_id", ["image_id"=>$image->id]);
|
||||||
$database->execute("DELETE FROM source_histories WHERE id = :id", ["id"=>$min_id]);
|
$database->execute("DELETE FROM source_histories WHERE id = :id", ["id"=>$min_id]);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
/** Load jQuery extensions **/
|
/** Load jQuery extensions **/
|
||||||
//Code via: http://stackoverflow.com/a/13106698
|
//Code via: https://stackoverflow.com/a/13106698
|
||||||
$.fn.highlight = function (fadeOut) {
|
$.fn.highlight = function (fadeOut) {
|
||||||
fadeOut = typeof fadeOut !== 'undefined' ? fadeOut : 5000;
|
fadeOut = typeof fadeOut !== 'undefined' ? fadeOut : 5000;
|
||||||
$(this).each(function () {
|
$(this).each(function () {
|
||||||
|
|
|
@ -6,7 +6,7 @@ class TagCategoriesInfo extends ExtensionInfo
|
||||||
|
|
||||||
public $key = self::KEY;
|
public $key = self::KEY;
|
||||||
public $name = "Tag Categories";
|
public $name = "Tag Categories";
|
||||||
public $url = "http://code.shishnet.org/shimmie2/";
|
public $url = "https://code.shishnet.org/shimmie2/";
|
||||||
public $authors = ["Daniel Oaks"=>"danneh@danneh.net"];
|
public $authors = ["Daniel Oaks"=>"danneh@danneh.net"];
|
||||||
public $description = "Let tags be split into 'categories', like Danbooru's tagging";
|
public $description = "Let tags be split into 'categories', like Danbooru's tagging";
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,12 @@ class TagEditInfo extends ExtensionInfo
|
||||||
<ul>
|
<ul>
|
||||||
<li>source=(*, none) eg -- using this metatag will ignore anything set in the \"Source\" box
|
<li>source=(*, none) eg -- using this metatag will ignore anything set in the \"Source\" box
|
||||||
<ul>
|
<ul>
|
||||||
<li>source=http://example.com -- set source to http://example.com
|
<li>source=https://example.com -- set source to https://example.com
|
||||||
<li>source=none -- set source to NULL
|
<li>source=none -- set source to NULL
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
<p>Metatags can be followed by \":\" rather than \"=\" if you prefer.
|
<p>Metatags can be followed by \":\" rather than \"=\" if you prefer.
|
||||||
<br />I.E: \"source:http://example.com\", \"source=http://example.com\" etc.
|
<br />I.E: \"source:https://example.com\", \"source=https://example.com\" etc.
|
||||||
<p>Some tagging metatags provided by extensions:
|
<p>Some tagging metatags provided by extensions:
|
||||||
<ul>
|
<ul>
|
||||||
<li>Numeric Score
|
<li>Numeric Score
|
||||||
|
|
|
@ -394,8 +394,8 @@ class TagHistory extends Extension
|
||||||
MySQL does NOT allow you to modify the same table which you use in the SELECT part.
|
MySQL does NOT allow you to modify the same table which you use in the SELECT part.
|
||||||
Which means that these will probably have to stay as TWO separate queries...
|
Which means that these will probably have to stay as TWO separate queries...
|
||||||
|
|
||||||
http://dev.mysql.com/doc/refman/5.1/en/subquery-restrictions.html
|
https://dev.mysql.com/doc/refman/5.1/en/subquery-restrictions.html
|
||||||
http://stackoverflow.com/questions/45494/mysql-error-1093-cant-specify-target-table-for-update-in-from-clause
|
https://stackoverflow.com/questions/45494/mysql-error-1093-cant-specify-target-table-for-update-in-from-clause
|
||||||
*/
|
*/
|
||||||
$min_id = $database->get_one("SELECT MIN(id) FROM tag_histories WHERE image_id = :image_id", ["image_id"=>$image->id]);
|
$min_id = $database->get_one("SELECT MIN(id) FROM tag_histories WHERE image_id = :image_id", ["image_id"=>$image->id]);
|
||||||
$database->execute("DELETE FROM tag_histories WHERE id = :id", ["id"=>$min_id]);
|
$database->execute("DELETE FROM tag_histories WHERE id = :id", ["id"=>$min_id]);
|
||||||
|
|
|
@ -13,7 +13,7 @@ class TagList extends Extension
|
||||||
$config->set_default_int(TagListConfig::LENGTH, 15);
|
$config->set_default_int(TagListConfig::LENGTH, 15);
|
||||||
$config->set_default_int(TagListConfig::POPULAR_TAG_LIST_LENGTH, 15);
|
$config->set_default_int(TagListConfig::POPULAR_TAG_LIST_LENGTH, 15);
|
||||||
$config->set_default_int(TagListConfig::TAGS_MIN, 3);
|
$config->set_default_int(TagListConfig::TAGS_MIN, 3);
|
||||||
$config->set_default_string(TagListConfig::INFO_LINK, 'http://en.wikipedia.org/wiki/$tag');
|
$config->set_default_string(TagListConfig::INFO_LINK, 'https://en.wikipedia.org/wiki/$tag');
|
||||||
$config->set_default_string(TagListConfig::OMIT_TAGS, 'tagme*');
|
$config->set_default_string(TagListConfig::OMIT_TAGS, 'tagme*');
|
||||||
$config->set_default_string(TagListConfig::IMAGE_TYPE, TagListConfig::TYPE_RELATED);
|
$config->set_default_string(TagListConfig::IMAGE_TYPE, TagListConfig::TYPE_RELATED);
|
||||||
$config->set_default_string(TagListConfig::RELATED_SORT, TagListConfig::SORT_ALPHABETICAL);
|
$config->set_default_string(TagListConfig::RELATED_SORT, TagListConfig::SORT_ALPHABETICAL);
|
||||||
|
@ -341,7 +341,7 @@ class TagList extends Extension
|
||||||
|
|
||||||
/*
|
/*
|
||||||
strtolower() vs. mb_strtolower()
|
strtolower() vs. mb_strtolower()
|
||||||
( See http://www.php.net/manual/en/function.mb-strtolower.php for more info )
|
( See https://www.php.net/manual/en/function.mb-strtolower.php for more info )
|
||||||
|
|
||||||
PHP5's strtolower function does not support Unicode (UTF-8) properly, so
|
PHP5's strtolower function does not support Unicode (UTF-8) properly, so
|
||||||
you have to use another function, mb_strtolower, to handle UTF-8 strings.
|
you have to use another function, mb_strtolower, to handle UTF-8 strings.
|
||||||
|
|
|
@ -30,20 +30,20 @@ var Tagger = {
|
||||||
this.tag.list = null;
|
this.tag.list = null;
|
||||||
this.tag.suggest = null;
|
this.tag.suggest = null;
|
||||||
this.tag.image_tags();
|
this.tag.image_tags();
|
||||||
|
|
||||||
// reveal
|
// reveal
|
||||||
this.editor.container.style.display = "";
|
this.editor.container.style.display = "";
|
||||||
|
|
||||||
// dragging
|
// dragging
|
||||||
DragHandler.attach(this.editor.titlebar);
|
DragHandler.attach(this.editor.titlebar);
|
||||||
|
|
||||||
// positioning
|
// positioning
|
||||||
this.position.load();
|
this.position.load();
|
||||||
|
|
||||||
// events
|
// events
|
||||||
window.onunload = function () { Tagger.position.save(); };
|
window.onunload = function () { Tagger.position.save(); };
|
||||||
},
|
},
|
||||||
|
|
||||||
alert : function (type,text,timeout) {
|
alert : function (type,text,timeout) {
|
||||||
var id = "tagger_alert-"+type;
|
var id = "tagger_alert-"+type;
|
||||||
var t_alert = byId(id);
|
var t_alert = byId(id);
|
||||||
|
@ -67,9 +67,9 @@ var Tagger = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
editor : {},
|
editor : {},
|
||||||
|
|
||||||
tag : {
|
tag : {
|
||||||
submit : function () {
|
submit : function () {
|
||||||
var l = this.list.childNodes.length;
|
var l = this.list.childNodes.length;
|
||||||
|
@ -82,14 +82,14 @@ var Tagger = {
|
||||||
this.parent.editor.tags.value = tags;
|
this.parent.editor.tags.value = tags;
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
search : function(s,ms) {
|
search : function(s,ms) {
|
||||||
clearTimeout(Tagger.tag.timer);
|
clearTimeout(Tagger.tag.timer);
|
||||||
Tagger.tag.timer = setTimeout(
|
Tagger.tag.timer = setTimeout(
|
||||||
"Tagger.tag.ajax('"+Tagger.tag.query+"?s="+s+"',Tagger.tag.receive)",
|
"Tagger.tag.ajax('"+Tagger.tag.query+"?s="+s+"',Tagger.tag.receive)",
|
||||||
ms);
|
ms);
|
||||||
},
|
},
|
||||||
|
|
||||||
receive : function (xml) {
|
receive : function (xml) {
|
||||||
if(xml) {
|
if(xml) {
|
||||||
Tagger.tag.suggest = document.importNode(
|
Tagger.tag.suggest = document.importNode(
|
||||||
|
@ -104,7 +104,7 @@ var Tagger = {
|
||||||
Tagger.alert("maxout",false);
|
Tagger.alert("maxout",false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
image_tags : function(xml) {
|
image_tags : function(xml) {
|
||||||
if (!xml) {
|
if (!xml) {
|
||||||
this.ajax(this.query+"/"+this.image,this.image_tags);
|
this.ajax(this.query+"/"+this.image,this.image_tags);
|
||||||
|
@ -115,10 +115,10 @@ var Tagger = {
|
||||||
Tagger.tag.publish(Tagger.tag.list,byId("tagger_p-applied"));
|
Tagger.tag.publish(Tagger.tag.list,byId("tagger_p-applied"));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
publish : function (list, page) {
|
publish : function (list, page) {
|
||||||
list.setAttribute("xmlns","http://www.w3.org/1999/xhtml");
|
list.setAttribute("xmlns","http://www.w3.org/1999/xhtml");
|
||||||
|
|
||||||
var l = list.childNodes.length;
|
var l = list.childNodes.length;
|
||||||
for(var i=0; i<l; i++) {
|
for(var i=0; i<l; i++) {
|
||||||
var tag = list.childNodes[i];
|
var tag = list.childNodes[i];
|
||||||
|
@ -128,11 +128,11 @@ var Tagger = {
|
||||||
};
|
};
|
||||||
tag.setAttribute("title",tag.getAttribute("count")+" uses");
|
tag.setAttribute("title",tag.getAttribute("count")+" uses");
|
||||||
}
|
}
|
||||||
|
|
||||||
page.innerHTML = "";
|
page.innerHTML = "";
|
||||||
page.appendChild(list);
|
page.appendChild(list);
|
||||||
},
|
},
|
||||||
|
|
||||||
create : function (tag_name) {
|
create : function (tag_name) {
|
||||||
if(tag_name.length > 0) {
|
if(tag_name.length > 0) {
|
||||||
var tag = document.createElement("tag");
|
var tag = document.createElement("tag");
|
||||||
|
@ -146,7 +146,7 @@ var Tagger = {
|
||||||
Tagger.tag.list.appendChild(tag);
|
Tagger.tag.list.appendChild(tag);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggle : function (tag) {
|
toggle : function (tag) {
|
||||||
if(tag.parentNode == this.list) {
|
if(tag.parentNode == this.list) {
|
||||||
this.list.removeChild(tag);
|
this.list.removeChild(tag);
|
||||||
|
@ -154,7 +154,7 @@ var Tagger = {
|
||||||
this.list.appendChild(tag);
|
this.list.appendChild(tag);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
ajax : function (url, callback) {
|
ajax : function (url, callback) {
|
||||||
var http = (new XMLHttpRequest() || new ActiveXObject("Microsoft.XMLHTTP"));
|
var http = (new XMLHttpRequest() || new ActiveXObject("Microsoft.XMLHTTP"));
|
||||||
http.open("GET",url,true);
|
http.open("GET",url,true);
|
||||||
|
@ -164,7 +164,7 @@ var Tagger = {
|
||||||
http.send(null);
|
http.send(null);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
position : {
|
position : {
|
||||||
set : function (x,y) {
|
set : function (x,y) {
|
||||||
if (!x || !y) {
|
if (!x || !y) {
|
||||||
|
@ -182,9 +182,9 @@ var Tagger = {
|
||||||
this.parent.editor.container.style.right = "";
|
this.parent.editor.container.style.right = "";
|
||||||
this.parent.editor.container.style.bottom = "";
|
this.parent.editor.container.style.bottom = "";
|
||||||
},
|
},
|
||||||
|
|
||||||
get : function () {
|
get : function () {
|
||||||
// http://www.quirksmode.org/js/findpos.html
|
// https://www.quirksmode.org/js/findpos.html
|
||||||
var left = 0;
|
var left = 0;
|
||||||
var top = 0;
|
var top = 0;
|
||||||
var obj = this.parent.editor.container;
|
var obj = this.parent.editor.container;
|
||||||
|
@ -198,7 +198,7 @@ var Tagger = {
|
||||||
}
|
}
|
||||||
return [left,top];
|
return [left,top];
|
||||||
},
|
},
|
||||||
|
|
||||||
save : function (x,y) {
|
save : function (x,y) {
|
||||||
if (!x || !y) {
|
if (!x || !y) {
|
||||||
var xy = this.get();
|
var xy = this.get();
|
||||||
|
@ -207,7 +207,7 @@ var Tagger = {
|
||||||
}
|
}
|
||||||
Cookies.set(config.title+"_tagger-position", x+" "+y, {expires: 14});
|
Cookies.set(config.title+"_tagger-position", x+" "+y, {expires: 14});
|
||||||
},
|
},
|
||||||
|
|
||||||
load : function () {
|
load : function () {
|
||||||
var p = Cookies.get(config.title+"_tagger-position");
|
var p = Cookies.get(config.title+"_tagger-position");
|
||||||
if(p) {
|
if(p) {
|
||||||
|
|
|
@ -346,7 +346,7 @@ class Wiki extends Extension
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
http://www.gnu.org/licenses/gpl.html
|
https://www.gnu.org/licenses/gpl.html
|
||||||
|
|
||||||
About:
|
About:
|
||||||
I searched a function to compare arrays and the array_diff()
|
I searched a function to compare arrays and the array_diff()
|
||||||
|
|
Reference in a new issue