public function enabled() { if (@file_exists(DIR_CACHE . 'sumo.guard.disabled')) { return 0; } $license = $this->config->get('license_key'); if (empty($license)) { return 2; } $valid = SumoGuard\Settings::v(); if (!$valid || !is_array($valid)) { return 3; } return 1; }
$data = array(); $data['t'] = time(); $data['h'] = self::ih($data['t']); $fp = fopen(DIR_CACHE . 'sumo.guard.data', 'w+'); fwrite($fp, json_encode($data)); fclose($fp); } // Internal hashing function private static function ih($t) { return strtoupper(sha1(strrev($t))); } // Internal time function to check if the given time is bigger/lower than the current private static function it($t) { $t = (int) $t; if (empty($t) || $t + rand(1, 24) * 3600 <= time()) { return false; } return true; } } class Reporter extends Sumo\Singleton { } abstract class Listener extends Sumo\Singleton { } if (defined('LICENSE_KEY')) { Settings::set('license_key', LICENSE_KEY); }