count less
This commit is contained in:
parent
9587bedae0
commit
f91daba264
5 changed files with 24 additions and 15 deletions
|
@ -116,15 +116,10 @@ class Tag
|
||||||
|
|
||||||
$tags1 = array_map("strtolower", $tags1);
|
$tags1 = array_map("strtolower", $tags1);
|
||||||
$tags2 = array_map("strtolower", $tags2);
|
$tags2 = array_map("strtolower", $tags2);
|
||||||
natcasesort($tags1);
|
sort($tags1);
|
||||||
natcasesort($tags2);
|
sort($tags2);
|
||||||
|
|
||||||
for ($i = 0; $i < count($tags1); $i++) {
|
return $tags1 == $tags2;
|
||||||
if ($tags1[$i]!==$tags2[$i]) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get_diff_tags(array $source, array $remove): array
|
public static function get_diff_tags(array $source, array $remove): array
|
||||||
|
|
|
@ -23,4 +23,13 @@ class TagTest extends TestCase
|
||||||
$this->assertEquals("foo^q", Tag::caret("foo?"));
|
$this->assertEquals("foo^q", Tag::caret("foo?"));
|
||||||
$this->assertEquals("a^^b^sc^bd^qe^af", Tag::caret("a^b/c\\d?e&f"));
|
$this->assertEquals("a^^b^sc^bd^qe^af", Tag::caret("a^b/c\\d?e&f"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_compare()
|
||||||
|
{
|
||||||
|
$this->assertFalse(Tag::compare(["foo"], ["bar"]));
|
||||||
|
$this->assertFalse(Tag::compare(["foo"], ["foo", "bar"]));
|
||||||
|
$this->assertTrue(Tag::compare([], []));
|
||||||
|
$this->assertTrue(Tag::compare(["foo"], ["FoO"]));
|
||||||
|
$this->assertTrue(Tag::compare(["foo", "bar"], ["bar", "FoO"]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1050,7 +1050,8 @@ class Artists extends Extension
|
||||||
ORDER BY alias ASC
|
ORDER BY alias ASC
|
||||||
", ['artist_id'=>$artistID]);
|
", ['artist_id'=>$artistID]);
|
||||||
|
|
||||||
for ($i = 0 ; $i < count($result) ; $i++) {
|
$rc = count($result);
|
||||||
|
for ($i = 0 ; $i < $rc ; $i++) {
|
||||||
$result[$i]["alias_name"] = stripslashes($result[$i]["alias_name"]);
|
$result[$i]["alias_name"] = stripslashes($result[$i]["alias_name"]);
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|
|
@ -439,7 +439,8 @@ class ArtistsTheme extends Themelet
|
||||||
$html .= "</tr>";
|
$html .= "</tr>";
|
||||||
|
|
||||||
if (count($aliases) > 1) {
|
if (count($aliases) > 1) {
|
||||||
for ($i = 1; $i < count($aliases); $i++) {
|
$ac = count($aliases);
|
||||||
|
for ($i = 1; $i < $ac; $i++) {
|
||||||
$aliasViewLink = str_replace("_", " ", $aliases[$i]['alias_name']); // no link anymore
|
$aliasViewLink = str_replace("_", " ", $aliases[$i]['alias_name']); // no link anymore
|
||||||
$aliasEditLink = "<a href='" . make_link("artist/alias/edit/" . $aliases[$i]['alias_id']) . "'>Edit</a>";
|
$aliasEditLink = "<a href='" . make_link("artist/alias/edit/" . $aliases[$i]['alias_id']) . "'>Edit</a>";
|
||||||
$aliasDeleteLink = "<a href='" . make_link("artist/alias/delete/" . $aliases[$i]['alias_id']) . "'>Delete</a>";
|
$aliasDeleteLink = "<a href='" . make_link("artist/alias/delete/" . $aliases[$i]['alias_id']) . "'>Delete</a>";
|
||||||
|
@ -482,7 +483,8 @@ class ArtistsTheme extends Themelet
|
||||||
$html .= "</tr>";
|
$html .= "</tr>";
|
||||||
|
|
||||||
if (count($members) > 1) {
|
if (count($members) > 1) {
|
||||||
for ($i = 1; $i < count($members); $i++) {
|
$mc = count($members);
|
||||||
|
for ($i = 1; $i < $mc; $i++) {
|
||||||
$memberViewLink = str_replace("_", " ", $members[$i]['name']); // no link anymore
|
$memberViewLink = str_replace("_", " ", $members[$i]['name']); // no link anymore
|
||||||
$memberEditLink = "<a href='" . make_link("artist/member/edit/" . $members[$i]['id']) . "'>Edit</a>";
|
$memberEditLink = "<a href='" . make_link("artist/member/edit/" . $members[$i]['id']) . "'>Edit</a>";
|
||||||
$memberDeleteLink = "<a href='" . make_link("artist/member/delete/" . $members[$i]['id']) . "'>Delete</a>";
|
$memberDeleteLink = "<a href='" . make_link("artist/member/delete/" . $members[$i]['id']) . "'>Delete</a>";
|
||||||
|
@ -527,7 +529,8 @@ class ArtistsTheme extends Themelet
|
||||||
$html .= "</tr>";
|
$html .= "</tr>";
|
||||||
|
|
||||||
if (count($urls) > 1) {
|
if (count($urls) > 1) {
|
||||||
for ($i = 1; $i < count($urls); $i++) {
|
$uc = count($urls);
|
||||||
|
for ($i = 1; $i < $uc; $i++) {
|
||||||
$urlViewLink = "<a href='" . str_replace("_", " ", $urls[$i]['url']) . "' target='_blank'>" . str_replace("_", " ", $urls[$i]['url']) . "</a>";
|
$urlViewLink = "<a href='" . str_replace("_", " ", $urls[$i]['url']) . "' target='_blank'>" . str_replace("_", " ", $urls[$i]['url']) . "</a>";
|
||||||
$urlEditLink = "<a href='" . make_link("artist/url/edit/" . $urls[$i]['id']) . "'>Edit</a>";
|
$urlEditLink = "<a href='" . make_link("artist/url/edit/" . $urls[$i]['id']) . "'>Edit</a>";
|
||||||
$urlDeleteLink = "<a href='" . make_link("artist/url/delete/" . $urls[$i]['id']) . "'>Delete</a>";
|
$urlDeleteLink = "<a href='" . make_link("artist/url/delete/" . $urls[$i]['id']) . "'>Delete</a>";
|
||||||
|
|
|
@ -154,16 +154,17 @@ class MimeType
|
||||||
private static function compare_file_bytes(string $file_name, array $comparison): bool
|
private static function compare_file_bytes(string $file_name, array $comparison): bool
|
||||||
{
|
{
|
||||||
$size = filesize($file_name);
|
$size = filesize($file_name);
|
||||||
if ($size < count($comparison)) {
|
$cc = count($comparison);
|
||||||
|
if ($size < $cc) {
|
||||||
// Can't match because it's too small
|
// Can't match because it's too small
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($fh = @fopen($file_name, 'rb'))) {
|
if (($fh = @fopen($file_name, 'rb'))) {
|
||||||
try {
|
try {
|
||||||
$chunk = unpack("C*", fread($fh, count($comparison)));
|
$chunk = unpack("C*", fread($fh, $cc));
|
||||||
|
|
||||||
for ($i = 0; $i < count($comparison); $i++) {
|
for ($i = 0; $i < $cc; $i++) {
|
||||||
$byte = $comparison[$i];
|
$byte = $comparison[$i];
|
||||||
if ($byte == null) {
|
if ($byte == null) {
|
||||||
continue;
|
continue;
|
||||||
|
|
Reference in a new issue