Browse Source

Fixed #154 The (-) & (+) buttons look like they're for voting

With thanks to 'buahaha' for the suggestion and Tim Brelig for some
direction.
master
Kroc Camen 8 years ago
parent
commit
f670ec8f88
37 changed files with 93 additions and 36 deletions
  1. BIN
      apple-touch-icon.default.png
  2. +20
    -8
      lib/websafe.php
  3. BIN
      metro-tile.default.png
  4. BIN
      themes/greyscale/apple-touch-icon.png
  5. +2
    -0
      themes/greyscale/img/.gitignore
  6. BIN
      themes/greyscale/img/add.png
  7. BIN
      themes/greyscale/img/add_2x.png
  8. BIN
      themes/greyscale/img/append.png
  9. BIN
      themes/greyscale/img/append_2x.png
  10. BIN
      themes/greyscale/img/delete.png
  11. BIN
      themes/greyscale/img/delete_2x.png
  12. BIN
      themes/greyscale/img/deletetitle.png
  13. BIN
      themes/greyscale/img/deletetitle_2x.png
  14. BIN
      themes/greyscale/img/folders.png
  15. BIN
      themes/greyscale/img/folders_2x.png
  16. +69
    -26
      themes/greyscale/img/generate_imgs.bat
  17. BIN
      themes/greyscale/img/go.png
  18. BIN
      themes/greyscale/img/help.png
  19. BIN
      themes/greyscale/img/help_2x.png
  20. BIN
      themes/greyscale/img/here.png
  21. BIN
      themes/greyscale/img/here_2x.png
  22. BIN
      themes/greyscale/img/lang.png
  23. BIN
      themes/greyscale/img/logo.png
  24. BIN
      themes/greyscale/img/new.png
  25. BIN
      themes/greyscale/img/new_2x.png
  26. BIN
      themes/greyscale/img/replies.png
  27. BIN
      themes/greyscale/img/replies_2x.png
  28. BIN
      themes/greyscale/img/rss.png
  29. BIN
      themes/greyscale/img/rss_2x.png
  30. BIN
      themes/greyscale/img/search.png
  31. BIN
      themes/greyscale/img/search_2x.png
  32. BIN
      themes/greyscale/img/sticky.png
  33. BIN
      themes/greyscale/img/submit.png
  34. BIN
      themes/greyscale/img/threads.png
  35. BIN
      themes/greyscale/img/threads_2x.png
  36. BIN
      themes/greyscale/metro-tile.png
  37. +2
    -2
      themes/greyscale/theme.css

BIN
apple-touch-icon.default.png View File

Before After
Width: 144  |  Height: 144  |  Size: 1.7KB Width: 144  |  Height: 144  |  Size: 1.7KB

+ 20
- 8
lib/websafe.php View File

@@ -31,21 +31,29 @@
//encoding, which can be exploited: <openmya.hacker.jp/hasegawa/public/20071107/s6/h6.html?file=datae.txt>
header ('Content-Type: text/html; charset=UTF-8');

/* Preprocess the super globals
/* preprocess the super globals:
---------------------------------------------------------------------------------------------------------------------- */
/* never trust your inputs! to help protect against malicious inputs, we're going to run through the superglobals
($_SERVER, $_COOKIES, $_REQUEST / $_GET / $_POST &c.) through our UTF-8 sanitisation. you'll still need to be wary of the
contents of your inputs (SQL/HTML injection, XSS &c.), and always safely combine strings (`safeURL`) and output safely
(`safeHTML`), but this process helps against the less-obvious Unicode-based attacks */
/* never trust your inputs! to help protect against malicious inputs, we're going to run the superglobals (`$_SERVER`,
`$_COOKIES`, `$_REQUEST` / `$_GET` / `$_POST` &c.) through our UTF-8 sanitisation. you'll still need to be wary of the
contents of your inputs (SQL/HTML injection, XSS &c.), and always safely combine strings (`safeURL`) and output safely
(`safeHTML`), but this process helps against the less-obvious Unicode-based attacks */
function preprocess_superglobals () {
/* "magic quotes" was a rather weak attempt at preventing injection attacks by automatically escaping the inputs
(`$_GET`, `$_POST` & `$_COOKIE`) with slashes (i.e. "won\'t"). this is however only relevant for SQL and not
HTML so introduces more complications in processing and outputting. this feature is removed entirely in PHP5.4.
if magic quotes is on, we strip the extra slashes from the inputs so as to normalise behaviour across different
servers and PHP versions */
if (get_magic_quotes_gpc ()) {
//great care has to be taken to pass and process the superglobals by reference
$gpc = array (&$_GET, &$_POST, &$_COOKIE, &$_ENV);
//drill through the selected superglobals, applying `stripslashes`
foreach ($gpc as &$_) array_walk_recursive ($_, create_function (
'&$value, $key',
'if (is_string ($value)) $value = stripslashes ($value);'
));
}
//magic quotes only applies to GET, POST, COOKIE & ENV, but we'll need to run the other sanitising functions
//on all the superglobals
$all = array (
&$_SERVER, //server environment, request headers, user agent string &c.
&$_REQUEST, //combined $_GET & $_POST
@@ -103,14 +111,18 @@ function safeUTF8 (
//Some interesting references:
//http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php#54805
//we still need to return, despite the by-reference parameter because use of anonymous variables and functions
//for the call will not be by-reference
return $text;
}

/* safeTrim : trim *all* kinds of whitespace, not just the ASCII space / tab / CRLF!
---------------------------------------------------------------------------------------------------------------------- */
//PHP `trim` doesn't cover a wide variety of Unicode; the private-use area is left, should the Apple logo be used
//<nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories>
function safeTrim (&$text) {
//PHP `trim` doesn't cover a wide variety of Unicode; the private-use area is left, should the Apple logo be used
//<nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories>
//we have to do this odd return because in order to preprocess the superglobals we have to call by-reference,
//but calls that use anonymous variables or function return values will not be by-reference
return $text = preg_replace ('/^[\pZ\p{Cc}\p{Cf}\p{Cn}\p{Cs}]+|[\pZ\p{Cc}\p{Cf}\p{Cn}\p{Cs}]+$/u', '', $text);
}


BIN
metro-tile.default.png View File

Before After
Width: 144  |  Height: 144  |  Size: 5.1KB Width: 144  |  Height: 144  |  Size: 101KB

BIN
themes/greyscale/apple-touch-icon.png View File

Before After
Width: 144  |  Height: 144  |  Size: 1.7KB Width: 144  |  Height: 144  |  Size: 1.7KB

+ 2
- 0
themes/greyscale/img/.gitignore View File

@@ -6,6 +6,8 @@

!add.png
!add_2x.png
!append.png
!append_2x.png
!bg.png
!delete.png
!delete_2x.png

BIN
themes/greyscale/img/add.png View File

Before After
Width: 16  |  Height: 16  |  Size: 353B Width: 16  |  Height: 16  |  Size: 371B

BIN
themes/greyscale/img/add_2x.png View File

Before After
Width: 32  |  Height: 32  |  Size: 687B Width: 32  |  Height: 32  |  Size: 738B

BIN
themes/greyscale/img/append.png View File

Before After
Width: 16  |  Height: 16  |  Size: 354B

BIN
themes/greyscale/img/append_2x.png View File

Before After
Width: 32  |  Height: 32  |  Size: 693B

BIN
themes/greyscale/img/delete.png View File

Before After
Width: 16  |  Height: 16  |  Size: 323B Width: 16  |  Height: 16  |  Size: 325B

BIN
themes/greyscale/img/delete_2x.png View File

Before After
Width: 32  |  Height: 32  |  Size: 617B Width: 32  |  Height: 32  |  Size: 769B

BIN
themes/greyscale/img/deletetitle.png View File

Before After
Width: 32  |  Height: 32  |  Size: 721B Width: 32  |  Height: 32  |  Size: 768B

BIN
themes/greyscale/img/deletetitle_2x.png View File

Before After
Width: 64  |  Height: 64  |  Size: 1.3KB Width: 64  |  Height: 64  |  Size: 1.4KB

BIN
themes/greyscale/img/folders.png View File

Before After
Width: 32  |  Height: 32  |  Size: 900B Width: 32  |  Height: 32  |  Size: 966B

BIN
themes/greyscale/img/folders_2x.png View File

Before After
Width: 64  |  Height: 64  |  Size: 1.9KB Width: 64  |  Height: 64  |  Size: 2.1KB

+ 69
- 26
themes/greyscale/img/generate_imgs.bat View File

@@ -20,11 +20,12 @@ CD /d %~dp0
:: =========================================================================================================================
:: convert the vector EPS to PNG, masking the alpha.
:: the antialias applied by default is no good, so we do it manually by resizing a very hires image down

ECHO icons white 1x...
convert +antialias -density 648 refs\brightmixIconset_v02.eps -colorspace RGB ^
-background "#f4f3f5" -resize 998x702 -alpha Shape -channel a -negate ^
icons_white_1x.png
IF NOT EXIST icons_white_1x.png (
ECHO icons white 1x...
convert +antialias -density 648 refs\brightmixIconset_v02.eps -colorspace RGB ^
-background "#f4f3f5" -resize 998x702 -alpha Shape -channel a -negate ^
icons_white_1x.png
)

:: crop and save the individual icons needed
:: -------------------------------------------------------------------------------------------------------------------------
@@ -73,8 +74,10 @@ convert icons_white_1x.png -crop "32x32+273+0" ^
:: black 1x
:: =========================================================================================================================
:: invert to produce the black set
ECHO. & ECHO icons black 1x...
convert icons_white_1x.png -negate icons_black_1x.png
IF NOT EXIST icons_black_1x.png (
ECHO. & ECHO icons black 1x...
convert icons_white_1x.png -negate icons_black_1x.png
)

ECHO * add.png
convert icons_black_1x.png -crop "16x16+875+152" ^
@@ -82,11 +85,11 @@ convert icons_black_1x.png -crop "16x16+875+152" ^
-define png:bit-depth=8 -define png:color-type=4 -define png:compression-level=0 ^
add.png

ECHO * delete.png
convert icons_black_1x.png -crop "16x16+875+177" ^
-background "#eeeeee" -type Grayscale -depth 8 -alpha On ^
-define png:bit-depth=8 -define png:color-type=4 -define png:compression-level=0 ^
delete.png
REM ECHO * delete.png
REM convert icons_black_1x.png -crop "16x16+875+177" ^
REM -background "#eeeeee" -type Grayscale -depth 8 -alpha On ^
REM -define png:bit-depth=8 -define png:color-type=4 -define png:compression-level=0 ^
REM delete.png

ECHO * here.png
convert icons_black_1x.png -crop "16x20+979+58" ^
@@ -106,13 +109,36 @@ convert icons_black_1x.png -crop "13x17+536+224" ^
-define png:bit-depth=8 -define png:color-type=4 -define png:compression-level=0 ^
search.png

:: the append icon is only available in large size (default:32x32), create a ½-size image so that we can get a 16x16 icon
IF NOT EXIST icons_black_half.png (
ECHO (icons black half-size...)
convert +antialias -density 144 refs\brightmixIconset_v02.eps -colorspace RGB ^
-background "#f4f3f5" -resize 499x351 -alpha Shape -channel a -negate ^
icons_black_half.png
convert icons_black_half.png -negate icons_black_half.png
)

ECHO * append.png
convert icons_black_half.png -crop "16x16+137+27" ^
-background "#888888" -type Grayscale -depth 8 -alpha On ^
-define png:bit-depth=8 -define png:color-type=4 -define png:compression-level=0 ^
append.png

ECHO * delete.png
convert icons_black_half.png -crop "16x16+312+135" ^
-background "#888888" -type Grayscale -depth 8 -alpha On ^
-define png:bit-depth=8 -define png:color-type=4 -define png:compression-level=0 ^
delete.png

:: white 2x
:: =========================================================================================================================
:: produce a version double the size for hi-DPI screens
ECHO. & ECHO icons white 2x...
convert +antialias -density 648 refs\brightmixIconset_v02.eps -colorspace RGB ^
-background "#f4f3f5" -resize 1996x1404 -alpha Shape -channel a -negate ^
icons_white_2x.png
IF NOT EXIST icons_white_2x.png (
ECHO. & ECHO icons white 2x...
convert +antialias -density 648 refs\brightmixIconset_v02.eps -colorspace RGB ^
-background "#f4f3f5" -resize 1996x1404 -alpha Shape -channel a -negate ^
icons_white_2x.png
)

ECHO * deletetitle_2x.png
convert icons_white_2x.png -crop "64x64+1250+540" ^
@@ -165,8 +191,10 @@ convert icons_white_2x.png -crop "64x64+546+0" ^
:: black 2x
:: =========================================================================================================================
:: invert to produce the black 2x set
ECHO. & ECHO icons black 2x...
convert icons_white_2x.png -negate icons_black_2x.png
IF NOT EXIST icons_black_2x.png (
ECHO. & ECHO icons black 2x...
convert icons_white_2x.png -negate icons_black_2x.png
)

ECHO * add_2x.png
convert icons_black_2x.png -crop "32x32+1750+304" ^
@@ -174,11 +202,11 @@ convert icons_black_2x.png -crop "32x32+1750+304" ^
-define png:bit-depth=8 -define png:color-type=4 -define png:compression-level=0 ^
add_2x.png

ECHO * delete_2x.png
convert icons_black_2x.png -crop "32x32+1750+354" ^
-background "#eeeeee" -type Grayscale -depth 8 -alpha On ^
-define png:bit-depth=8 -define png:color-type=4 -define png:compression-level=0 ^
delete_2x.png
REM ECHO * delete_2x.png
REM convert icons_black_2x.png -crop "32x32+1750+354" ^
REM -background "#eeeeee" -type Grayscale -depth 8 -alpha On ^
REM -define png:bit-depth=8 -define png:color-type=4 -define png:compression-level=0 ^
REM delete_2x.png

ECHO * go.png (2x)
convert icons_black_2x.png -crop "40x40+1352+228" ^
@@ -216,6 +244,19 @@ convert icons_black_2x.png -crop "32x32+362+446" ^
-define png:bit-depth=8 -define png:color-type=4 -define png:compression-level=0 ^
sticky.png

::the 2x append / delete icon (32x32) actually comes from the 1x sheet
ECHO * append_2x.png
convert icons_black_1x.png -crop "32x32+273+54" ^
-background "#888888" -type Grayscale -depth 8 -alpha On ^
-define png:bit-depth=8 -define png:color-type=4 -define png:compression-level=0 ^
append_2x.png

ECHO * delete_2x.png
convert icons_black_1x.png -crop "32x32+625+270" ^
-background "#888888" -type Grayscale -depth 8 -alpha On ^
-define png:bit-depth=8 -define png:color-type=4 -define png:compression-level=0 ^
delete_2x.png

:: apple-touch-icon
ECHO. & ECHO apple-touch-icon.png
convert +antialias -density 648 refs\brightmixIconset_v02.eps -colorspace RGB ^
@@ -227,13 +268,14 @@ convert +antialias -density 648 refs\brightmixIconset_v02.eps -colorspace RGB ^
:: compress PNGs
:: =========================================================================================================================
:: remove the big temporary files
DEL icons_white_1x.png icons_black_1x.png icons_white_2x.png icons_black_2x.png
DEL icons_white_1x.png icons_black_1x.png icons_white_2x.png icons_black_2x.png icons_black_half.png

FOR %%F in (*.png) DO (
ECHO Optimising %%F...
bin\pngout.exe "%%F" /c4 /kbKGD /y /q
bin\optipng.exe -o7 -clobber -quiet "%%F"
bin\pngcrush.exe -brute -keep bKGD -l 9 -ow -reduce -q "%%F"
bin\pngcrush.exe -brute -fix -keep bKGD -l 9 -reduce -q "%%F"
IF %ERRORLEVEL% EQU 0 ERASE "%%F" & REN "pngout.png" "%%F"
)

DEL ..\..\..\apple-touch-icon.default.png
@@ -257,7 +299,8 @@ ECHO optimising metro-tile.png...
REM "-nx" preserves bit-depth and colour-type
bin\optipng.exe -o7 -zm1-9 -clobber -quiet -nx metro-tile.png
REM "-bit_depth 8 -c 6" preserves bit-depth and colour-type
bin\pngcrush.exe -bit_depth 8 -c 6 -l 9 -loco -ow -q metro-tile.png
bin\pngcrush.exe -bit_depth 8 -c 6 -fix -l 9 -q metro-tile.png
IF %ERRORLEVEL% EQU 0 ERASE metro-tile.png & REN pngout.png metro-tile.png

DEL ..\..\..\metro-tile.default.png
COPY /Y metro-tile.png ..\..\..\metro-tile.default.png

BIN
themes/greyscale/img/go.png View File

Before After
Width: 40  |  Height: 40  |  Size: 325B Width: 40  |  Height: 40  |  Size: 470B

BIN
themes/greyscale/img/help.png View File

Before After
Width: 32  |  Height: 32  |  Size: 802B Width: 32  |  Height: 32  |  Size: 867B

BIN
themes/greyscale/img/help_2x.png View File

Before After
Width: 64  |  Height: 64  |  Size: 1.6KB Width: 64  |  Height: 64  |  Size: 1.7KB

BIN
themes/greyscale/img/here.png View File

Before After
Width: 16  |  Height: 20  |  Size: 385B Width: 16  |  Height: 20  |  Size: 416B

BIN
themes/greyscale/img/here_2x.png View File

Before After
Width: 32  |  Height: 40  |  Size: 789B Width: 32  |  Height: 40  |  Size: 848B

BIN
themes/greyscale/img/lang.png View File

Before After
Width: 40  |  Height: 40  |  Size: 492B Width: 40  |  Height: 40  |  Size: 541B

BIN
themes/greyscale/img/logo.png View File

Before After
Width: 64  |  Height: 64  |  Size: 1.5KB Width: 64  |  Height: 64  |  Size: 1.6KB

BIN
themes/greyscale/img/new.png View File

Before After
Width: 32  |  Height: 32  |  Size: 652B Width: 32  |  Height: 32  |  Size: 694B

BIN
themes/greyscale/img/new_2x.png View File

Before After
Width: 64  |  Height: 64  |  Size: 1.2KB Width: 64  |  Height: 64  |  Size: 1.3KB

BIN
themes/greyscale/img/replies.png View File

Before After
Width: 32  |  Height: 32  |  Size: 777B Width: 32  |  Height: 32  |  Size: 834B

BIN
themes/greyscale/img/replies_2x.png View File

Before After
Width: 64  |  Height: 64  |  Size: 1.5KB Width: 64  |  Height: 64  |  Size: 1.6KB

BIN
themes/greyscale/img/rss.png View File

Before After
Width: 16  |  Height: 16  |  Size: 363B Width: 16  |  Height: 16  |  Size: 380B

BIN
themes/greyscale/img/rss_2x.png View File

Before After
Width: 32  |  Height: 32  |  Size: 854B Width: 32  |  Height: 32  |  Size: 914B

BIN
themes/greyscale/img/search.png View File

Before After
Width: 13  |  Height: 17  |  Size: 317B Width: 13  |  Height: 17  |  Size: 334B

BIN
themes/greyscale/img/search_2x.png View File

Before After
Width: 26  |  Height: 34  |  Size: 668B Width: 26  |  Height: 34  |  Size: 728B

BIN
themes/greyscale/img/sticky.png View File

Before After
Width: 32  |  Height: 32  |  Size: 704B Width: 32  |  Height: 32  |  Size: 752B

BIN
themes/greyscale/img/submit.png View File

Before After
Width: 80  |  Height: 80  |  Size: 350B Width: 80  |  Height: 80  |  Size: 490B

BIN
themes/greyscale/img/threads.png View File

Before After
Width: 32  |  Height: 32  |  Size: 757B Width: 32  |  Height: 32  |  Size: 810B

BIN
themes/greyscale/img/threads_2x.png View File

Before After
Width: 64  |  Height: 64  |  Size: 1.4KB Width: 64  |  Height: 64  |  Size: 1.5KB

BIN
themes/greyscale/metro-tile.png View File

Before After
Width: 144  |  Height: 144  |  Size: 5.1KB Width: 144  |  Height: 144  |  Size: 101KB

+ 2
- 2
themes/greyscale/theme.css View File

@@ -239,7 +239,7 @@ article header .ui,
transition: all .2s;}

a.delete {background: url("img/delete.png") no-repeat right center; background-size: 16px 16px;}
a.append {background: url("img/add.png") no-repeat right center; background-size: 16px 16px;}
a.append {background: url("img/append.png") no-repeat right center; background-size: 16px 16px;}

article.nnf_op {}
article.nnf_op header {background: #888; color: #eee;}
@@ -536,7 +536,7 @@ section>h1 + nav {background: none; float: right; margin-top: -50px !important;
#nnf_threads h1, #nnf_post h1 {background-image: url("img/threads_2x.png");}
#nnf_replies h1 {background-image: url("img/replies_2x.png");}
a.delete {background-image: url("img/delete_2x.png");}
a.append {background-image: url("img/add_2x.png");}
a.append {background-image: url("img/append_2x.png");}
#markup h1, #privacy h1 {background-image: url("img/help_2x.png");}
#nnf_new-form h1,
#nnf_reply-form h1, #append h1 {background-image: url("img/new_2x.png");}

Loading…
Cancel
Save