Search    Register    Log In   

By on Sep 14, 2015 at 4:23 PM

Most of my clients make most of their revenue from displaying advertising. With that in mind, I've been working on a new script called WSN AdUnblocker to help increase advertising revenues.

If like many of us you use an ad blocker to browse the web, you may have noticed some sites detect that and ask you to whitelist them to allow their ads to be displayed. If you're like me, you'll give that a try and leave them whitelisted as long as their ads aren't so aggressive that they make the site hard to use.

There's no completely generic way to detect and deal with ad blocking, because every web script works a bit different. Fortunately I've been able to simplify it to the point where it's very easy for anyone using WSN's advertising system.

For any other script it'll need a way to add jquery and jquery ui if not already present, then a way to add a line to the jquery document ready function and add a div around the ad, and then a specification of what pages to expect an ad on. This is likely too complicated to expect the average webmaster to work out on their own, but it's something I can
do as an affordable service.

So far I've got options to customize the language and to choose how often to re-prompt (either every page load if you don't want to allow freeloading or every X days if you want to be gentle with an occasional prod).

By on Sep 04, 2015 at 2:18 PM

The last few days have seen several releases relating to MIME HTML emails. Here's what happened.

The first discovery was that sites which had been sending MIME messages okay before started spitting out error and not sending the mail when their web servers updated to PHP 5.5.26 or later. I investigated and found that PHP version included a change to PHP's mail function restricting what can be sent in the headers field, in an attempt to stop malicious header injections. Unforunately it stopped the MIME code of WSN and many other scripts. I rewrote all the MIME code to use simpler headers and transfered much of it to the message field.

That patch worked for me, but actually created a problem on a PHP 5.4 server which was unable to parse message field headers that used windows-style line breaks. I converted to the PHP_EOL constant and that made all PHP versions work at the same time, finally.

If you have any website which is sending MIME emails by default, please be aware that it either already has or soon will stop sending emails (when you reach PHP 5.5.26) until you update to the latest release of one of the active WSN series: 8.0, 9.0, 9.1 or 9.2.

By on Aug 26, 2015 at 3:58 PM

Went to a developers meetup last night that covered RethinkDB and Grunt.

RethinkDB is a NoSQL database with a query syntax that reminds me of jQuery, lots of chained selectors. The primary application seems to be highly reponsive real-time apps, where its push notifications provide a simpler and more scalable alternative to having to poll the database every few seconds. It might be useful for a future project but I won't be using it for WSN because of the impracticality of helping everyone to install it on their servers. Really the only components where it'd be notably better than MySQL are the chat and IM systems.

Grunt looks much more useful for my development process. It's a task automation tool with 5000 different task plugins, especially useful for the build and release process. I've already built a suite of custom automation and release tools for WSN, but I'll be incorproating Grunt into those in the future to leverage all the plugins.

By on Aug 19, 2015 at 4:31 PM

Cool discovery of the day: SQL Fiddle. Should help with quick tests.

I've been working hard on smoothing more rough edges of the bootstrap theme. That includes collapsing the menu panel at mobile sizes, styling quoted posts, and fixing up a bunch of templates. Almost ready to roll out bootstrap as a default option during setup with a choice of bootswatch color schemes. Hopefully this will prove helpful to people who don't have time to mess with the stylesheet.

By on Aug 16, 2015 at 11:14 PM

Gravatars are centrally-stored avatars used by wordpress and many other scripts. The latest WSN release ads an "autoload gravitars" switch, which finds the gravatar for anyone who doesn't upload their own avatar when registering.

If you have a lot of current avatarless members, you may want to go back and load gravatars for them to make your site and especially the comments threads a bit more colorful/personalized. To do that, copy this script to a text file and save it as loadgravatars.php:

require 'start.php';
if (!$start) $start = 0;
if (!$perpage) $perpage = 50;
$q = $db->select('all', 'memberstable', "1=1", "ORDER BY id DESC", "LIMIT $start,$perpage");
$n = $db->numrows($q);
$m = new member('row', $db->row($q));
if ($m->avatarname == '' && $m->email != '')
$filename = md5(strtolower(trim($m->email))).'.png';
$gravatarurl = "http://www.gravatar.com/avatar/".$filename;
$checkurl = $gravatarurl.'?d=404';
$test = urlheaders($checkurl);
$exists = true;
foreach($test as $t) { if (strstr($t, '404 Not Found')) $exists = false; }
if ($exists)
$m->avatarname = uploadurl($gravatarurl, $filename, false, 'avatars');
$msg .= 'Added gravatar for '.$m->profileurl().'...';
$start += $perpage;
if ($n) indirectredirect($msg." Continuing to next batch...", "loadgravatars.php?start=$start");
else die("Done!");
require 'end.php';

Upload that to your WSN installation's main directory and visit it in your web browser to start loading gravatars.
<< February 2019 >>

Recent Comments