From 895b263c8a26a1eda31d4c97b8805b6135b32eee Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 1 Feb 2012 23:40:16 -0800 Subject: [PATCH] nsfw - use regex matching if word starts with '/' --- nsfw.tgz | Bin 1428 -> 1467 bytes nsfw/nsfw.php | 21 ++++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/nsfw.tgz b/nsfw.tgz index 187ef0150cdca3fd8db6f96d465ecb91c77239db..b9dc85be0f2c15b23ec35a722e4b22e7ff89fc2a 100755 GIT binary patch literal 1467 zcmV;s1w{HEiwFS4Jt|KC1ML^vZre80uhv(bX<4Ndj^#@n2Tq)!NZY5i9hPBzNCJbF zD4VcE3M7>@81nBsBo$xcwrSTUeW(tQz#`B6POj4HsPVYaK^P7Ojox5?*z4^#I)j7W z!G71CSJ3Eohuz+O|KQ+Y*y!NLpx=POBkN_MRGLVDMo!`xlUIy?0kD%Y_6d&+2CvwL4o)*Ojy7uVSs~B7hnW$|BpP^9YG-uk7 zY#9dJY8qIAiewv;a|19>tkZ)Q61mMGF#|k}}i46xj2mUAKqt1*`dA z%!@~o@j(5X(|h}0e}7Qd|C7M+?-+N_^P=a^J$MdpNlr&#n*x5lq$-xI&`j_VoQf{D(?qsk-fs`F>IAxsW4x!xj|Y+_@T#=UNw|C|Wwd z9g93djw#D%lq2$qp~k<+^U{*XMinsWI>9!hNtT7XW`mG)#+0UVG8bYI1_gE+BI#r* zlAE9f0Z9_Uqm5KI$Cl3q?(WexudKx7WTL3n*z43o?CjkN`(cI?PV2a*^}pY4#=vmIr;<#|n(hQB~2VvoqZe zx|AIG0YZeyoFpJhiR14kqiRm6Hgn4iwZcqECEyy1fpEwPX1m3#q#^zw3JeyOJ1eeerLvU<{AI{8d?5_m*0Q#n&V_(w`I>INL4|7S=u^&L&vYJsn znc^5OrOALc1kruRA(252d>rcuBV!+v#fRv`9QqgXg8N6t6FY9BAA{joU}>jp7Os1y z<;H$1u!uI8)_ac7_-)C;Vzz?HgFDL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2<^T6Gee>MY&>{UC|~Go&ZZxpum45 z%`*~Hhgo8I*G$iWfFEZpUVs)La>}DP6N>tfF}`R)LQ_&?8khpRp0um>@U3Wl|L61k zkE^ZlaGb0J6YhAk+(xpOrf&$Z4+QM7V? zI~L0b5mT1YXo<`xMjC%2&r1s)8&$xh>jc}3CRr9X%>*Ioj44g!WG=)a407x=MAFGr zBsW0|0+J+xM_Z|GmMzW}Z}VsuD=Tm~nJB6?_B!bT^!M~+zcG14tIS)a8wR?6vw9OnoYmnBnhBDsrygEz6pCA)4$tH!OGHf=zItEY| zk|Q1;2Mj8a99$|cFS3whR|XGoW;~;w83kT zy%QsL9?bPJn^Temm(U(VaBMC=yfd@0zdpzZ&^I|9``m`j?D{Q%k)YDV>B ziq~)LrJb@_xapae zyY^dwWwgPx-gAP+Zz~AP*$PSzHk7k3VOMyc6Q$6=(m#7sJYnIVAnPXQyl=JBVPFT9 zGc%~X#u?wEZY4O8P5y7p_n~jBfdUxY{%QXS0pQF8E$uG zJFwB)hK|tWlT8oD86{}5+xU`5xaZl*TX0gU>(q0*{#yCFg$<4GmOhTWWePg<%&t0z z8G}j_R{E~1@b>c+ZOgwb>!~g42ddg^HzvQoJNxrI*ibyUv>mjrzAXP+I14Ygaoomb z)09S?@l=GyP?Hy{oW-I03g=mC_N#Zl8P3~X12-G-wq>gl<3*Oa3f!{OTJT>=`PR9` z)v`k&QX&TZkY^&HA#%6MZO2YCoDDV@@i(~%9kOFVb=^Z?3@Jfwr*Di)Iy6G1x>$0Q z#B;l33dx@0wp=9f*^yBmI)~fMQnFq*BM9S#fv(#Vt%!N2;7{0?x-J`Bwo18DY^9f$ zrEGnQN-Rp4T@y!qH3f7C;$K+7{&eo diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php index 71880499..332e8224 100755 --- a/nsfw/nsfw.php +++ b/nsfw/nsfw.php @@ -86,14 +86,21 @@ function nsfw_prepare_body(&$a,&$b) { if(! strlen(trim($word))) { continue; } - - if(stristr($b['html'],$word)) { - $found = true; - break; + if(strpos($word,'/') === 0) { + if(preg_match($word,$b['html'])) { + $found = true; + break; + } } - if(stristr($b['item']['tag'], ']' . $word . '[' )) { - $found = true; - break; + else { + if(stristr($b['html'],$word)) { + $found = true; + break; + } + if(stristr($b['item']['tag'], ']' . $word . '[' )) { + $found = true; + break; + } } } }