Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function wpfpVerifyReg($regkey)
- {
- $licStatus = wpfpLicenseCheck("http://wpmobilepro.com/licensecheck/regcheck.php", $regkey);
- return $licStatus;
- }
- function wpfpbuildQueryString($arr, $urlEncodeValues = 1)
- {
- foreach ($arr as $key => $value) {
- $qstr .= ($urlEncodeValues == 1) ? $key . '=' . urlencode($value) . '&' : $key . '=' . $value . '&';
- }
- rtrim($qstr, '&');
- return $qstr;
- }
- function wpfpRegister($UrlPathAndFunctionName, $params = array("cont" => ""))
- {
- $paramsstr = wpfpbuildQueryString($params);
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $UrlPathAndFunctionName);
- if ($params != "") {
- curl_setopt($ch, CURLOPT_POST, count($params));
- curl_setopt($ch, CURLOPT_POSTFIELDS, $paramsstr);
- }
- curl_setopt($ch, CURLOPT_TIMEOUT, 3);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $page = curl_exec($ch);
- curl_close($ch);
- return $page;
- }
- function wpfpLicenseCheck($url, $regkey)
- {
- global $wpdb;
- $d = plugin_basename('e5be35e612_copy.php');
- $m = explode("/", $d);
- if (!function_exists('get_plugins')) {
- require_once(ABSPATH . '/wp-admin/includes/plugin.php');
- }
- $plugins = get_plugins();
- $key = null;
- foreach ($plugins AS $p => $t) {
- if (strpos($p, $m[0]) !== false) {
- $key = $p;
- break;
- }
- }
- $v = 0;
- if (isset($plugins[$key])) {
- $v = $plugins[$key]['Version'];
- }
- $wpfpVersionIntID = preg_replace("/\W/", "", $v);
- $theme_data = get_bloginfo('template_url') . '/style.css';
- $wpfpVersionIntID = get_option('revchurch_vers');
- $responseCode = wpfpRegister($url, array(
- "ip" => $_SERVER['SERVER_ADDR'],
- "url" => get_option('home'),
- "regkey" => $regkey,
- "ver" => $wpfpVersionIntID,
- "phpver" => phpversion(),
- "mysqlver" => $wpdb->get_var($wpdb->prepare("SELECT version() as version;"))
- ));
- if ($responseCode === '1') {
- return '1';
- } else if ($responseCode === '9') {
- return '0';
- } else {
- return "unknown";
- }
- }
- function wpwfgetRemoteHTML($contentURL)
- {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $contentURL);
- curl_setopt($ch, CURLOPT_TIMEOUT, 5);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- $html = curl_exec($ch);
- curl_close($ch);
- return $html;
- }
- function verifyTheme()
- {
- $isActive = rci_validateLocal();
- if ($isActive) {
- $isActive = rci_validateRemote();
- }
- return $isActive;
- }
- function add_tets()
- {
- if (!rci_validateLocal()) {
- $a = '<div class="error fade" style="background-color:red;"><p><strong>Sorry. This theme is not active. Please activate it in the Theme Settings.</strong></p></div>';
- echo ($a);
- exit();
- } else {
- echo '<link href="' . get_bloginfo("template_directory") . '/style.php" rel="stylesheet" type="text/css" />';
- }
- }
- function my_admin_notice()
- {
- if (!rci_validateLocal()) {
- echo '<div class="error fade"><p><strong>This theme requires an Activation Key to work. Please activate it in the <a href="' . admin_url('admin.php?page=functions.php') . '">Theme Settings.</a></strong></p></div>';
- }
- }
- function error_key_notice()
- {
- echo '<div class="error fade" id="errorKey"><p><strong>Sorry. You entered the wrong Activation Key.</strong></p></div>';
- }
- function activatetheme_byKey($regkey)
- {
- return rci_registerRemote($regkey);
- }
- function deactivatetheme_byKey($regkey)
- {
- $flag = false;
- $actKey = wpfpVerifyReg($regkey);
- if ($actKey === '1') {
- rci_setLicenseInvalid();
- $flag = true;
- }
- return $flag;
- }
- function deactivatetheme_byStatusKey($regkey)
- {
- $flag = false;
- if ($regkey == "0") {
- $status = wpfpVerifyReg('deactivate');
- rci_setLicenseInvalid();
- $flag = true;
- }
- return $flag;
- }
- function encrypt_string($input)
- {
- $val = strlen($input);
- $data = $input . "-" . $val . "RapidCrush";
- $crypttext = md5($data);
- return $crypttext;
- }
- function IsThemeVerified()
- {
- return verifyTheme();
- }
- function rci_validateLocal()
- {
- $statuscode = get_option('mobtheme_act_st');
- $key = get_option('mobtheme_reg_key');
- $key_hash = get_option('mobtheme_reg_key_hash');
- $stat_flag = true;
- if ((trim($statuscode) == '0') || ($statuscode == '')) {
- $stat_flag = false;
- } else if ((empty($key)) || (empty($key_hash))) {
- $stat_flag = false;
- } else if ($key_hash != encrypt_string($key)) {
- $stat_flag = false;
- }
- if (!$stat_flag && ($statuscode || !empty($key))) {
- rci_setLicenseInvalid();
- }
- return $stat_flag;
- }
- function rci_registerRemote($regkey)
- {
- $status = wpfpVerifyReg($regkey);
- if ($status === '1') {
- rci_setLicenseValid($regkey);
- return true;
- } else {
- rci_setLicenseInvalid();
- return false;
- }
- }
- function rci_validateRemote()
- {
- $key = get_option('mobtheme_reg_key');
- $status = wpfpVerifyReg($key);
- if ($status === '0') {
- rci_setLicenseInvalid();
- return false;
- } else {
- return true;
- }
- }
- function rci_setLicenseInvalid()
- {
- update_option("mobtheme_act_st", "0");
- delete_option("mobtheme_reg_key");
- }
- function rci_setLicenseValid($regkey)
- {
- $encryptedKey = encrypt_string($regkey);
- update_option("mobtheme_act_st", "1");
- update_option("mobtheme_reg_key", $regkey);
- update_option("mobtheme_reg_key_hash", $encryptedKey);
- }
- function rci_validateAtLogin($username)
- {
- $checkRemote = false;
- $user = get_userdatabylogin($username);
- if (isset($user->ID) && $user->ID) {
- $roles = get_option('wp_user_roles');
- if (isset($user->wp_capabilities)) {
- $userRoles = $user->wp_capabilities;
- if (is_array($userRoles)) {
- $userRoles = array_keys($userRoles, true);
- $userRole = array_shift($userRoles);
- if (isset($roles[$userRole]['capabilities'])) {
- $capabilities = $roles[$userRole]['capabilities'];
- if (in_array('manage_options', array_keys($capabilities, true))) {
- $checkRemote = true;
- }
- }
- }
- }
- }
- if ($checkRemote) {
- $isActive = rci_validateLocal();
- if ($isActive) {
- $result = rci_validateRemote();
- }
- }
- }
- function upgrade()
- {
- return get_template() . "/upgrade/notifier.xml";
- }
- function upgradefilename()
- {
- return get_template() . "/upgrade/" . get_template() . ".zip";
- }
- add_action('wp_login', 'rci_validateAtLogin', 99999, 1);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement