Losing custom widgets when WordPress updated

I need help with the custom widgets I created. They work, but I'm losing them with every WordPress update and since this is a multisite site with 19 sites, it's getting tedious. The theme is a custom one I created so it's not getting updated, just WP and other plugins. I modified some code I found in a tutorial. Longish, so I put it up at pastebin - http://pastebin.com/rZcDSw2W. Any idea what the issue could be?