Advertisement
plas71k

php lockit file - decoded

Dec 12th, 2012
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.90 KB | None | 0 0
  1. <?php
  2. function wpfpVerifyReg($regkey)
  3. {
  4.     $licStatus = wpfpLicenseCheck("http://wpmobilepro.com/licensecheck/regcheck.php", $regkey);
  5.     return $licStatus;
  6. }
  7. function wpfpbuildQueryString($arr, $urlEncodeValues = 1)
  8. {
  9.     foreach ($arr as $key => $value) {
  10.         $qstr .= ($urlEncodeValues == 1) ? $key . '=' . urlencode($value) . '&' : $key . '=' . $value . '&';
  11.     }
  12.     rtrim($qstr, '&');
  13.     return $qstr;
  14. }
  15. function wpfpRegister($UrlPathAndFunctionName, $params = array("cont" => ""))
  16. {
  17.     $paramsstr = wpfpbuildQueryString($params);
  18.     $ch        = curl_init();
  19.     curl_setopt($ch, CURLOPT_URL, $UrlPathAndFunctionName);
  20.     if ($params != "") {
  21.         curl_setopt($ch, CURLOPT_POST, count($params));
  22.         curl_setopt($ch, CURLOPT_POSTFIELDS, $paramsstr);
  23.     }
  24.     curl_setopt($ch, CURLOPT_TIMEOUT, 3);
  25.     curl_setopt($ch, CURLOPT_HEADER, 0);
  26.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  27.     $page = curl_exec($ch);
  28.     curl_close($ch);
  29.     return $page;
  30. }
  31. function wpfpLicenseCheck($url, $regkey)
  32. {
  33.     global $wpdb;
  34.     $d = plugin_basename('e5be35e612_copy.php');
  35.     $m = explode("/", $d);
  36.     if (!function_exists('get_plugins')) {
  37.         require_once(ABSPATH . '/wp-admin/includes/plugin.php');
  38.     }
  39.     $plugins = get_plugins();
  40.     $key     = null;
  41.     foreach ($plugins AS $p => $t) {
  42.         if (strpos($p, $m[0]) !== false) {
  43.             $key = $p;
  44.             break;
  45.         }
  46.     }
  47.     $v = 0;
  48.     if (isset($plugins[$key])) {
  49.         $v = $plugins[$key]['Version'];
  50.     }
  51.     $wpfpVersionIntID = preg_replace("/\W/", "", $v);
  52.     $theme_data       = get_bloginfo('template_url') . '/style.css';
  53.     $wpfpVersionIntID = get_option('revchurch_vers');
  54.     $responseCode     = wpfpRegister($url, array(
  55.         "ip" => $_SERVER['SERVER_ADDR'],
  56.         "url" => get_option('home'),
  57.         "regkey" => $regkey,
  58.         "ver" => $wpfpVersionIntID,
  59.         "phpver" => phpversion(),
  60.         "mysqlver" => $wpdb->get_var($wpdb->prepare("SELECT version() as version;"))
  61.     ));
  62.     if ($responseCode === '1') {
  63.         return '1';
  64.     } else if ($responseCode === '9') {
  65.         return '0';
  66.     } else {
  67.         return "unknown";
  68.     }
  69. }
  70. function wpwfgetRemoteHTML($contentURL)
  71. {
  72.     $ch = curl_init();
  73.     curl_setopt($ch, CURLOPT_URL, $contentURL);
  74.     curl_setopt($ch, CURLOPT_TIMEOUT, 5);
  75.     curl_setopt($ch, CURLOPT_HEADER, 0);
  76.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  77.     $html = curl_exec($ch);
  78.     curl_close($ch);
  79.     return $html;
  80. }
  81. function verifyTheme()
  82. {
  83.     $isActive = rci_validateLocal();
  84.     if ($isActive) {
  85.         $isActive = rci_validateRemote();
  86.     }
  87.     return $isActive;
  88. }
  89. function add_tets()
  90. {
  91.     if (!rci_validateLocal()) {
  92.         $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>';
  93.         echo ($a);
  94.         exit();
  95.     } else {
  96.         echo '<link href="' . get_bloginfo("template_directory") . '/style.php" rel="stylesheet" type="text/css" />';
  97.     }
  98. }
  99. function my_admin_notice()
  100. {
  101.     if (!rci_validateLocal()) {
  102.         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>';
  103.     }
  104. }
  105. function error_key_notice()
  106. {
  107.     echo '<div class="error fade" id="errorKey"><p><strong>Sorry. You entered the wrong Activation Key.</strong></p></div>';
  108. }
  109. function activatetheme_byKey($regkey)
  110. {
  111.     return rci_registerRemote($regkey);
  112. }
  113. function deactivatetheme_byKey($regkey)
  114. {
  115.     $flag   = false;
  116.     $actKey = wpfpVerifyReg($regkey);
  117.     if ($actKey === '1') {
  118.         rci_setLicenseInvalid();
  119.         $flag = true;
  120.     }
  121.     return $flag;
  122. }
  123. function deactivatetheme_byStatusKey($regkey)
  124. {
  125.     $flag = false;
  126.     if ($regkey == "0") {
  127.         $status = wpfpVerifyReg('deactivate');
  128.         rci_setLicenseInvalid();
  129.         $flag = true;
  130.     }
  131.     return $flag;
  132. }
  133. function encrypt_string($input)
  134. {
  135.     $val       = strlen($input);
  136.     $data      = $input . "-" . $val . "RapidCrush";
  137.     $crypttext = md5($data);
  138.     return $crypttext;
  139. }
  140. function IsThemeVerified()
  141. {
  142.     return verifyTheme();
  143. }
  144. function rci_validateLocal()
  145. {
  146.     $statuscode = get_option('mobtheme_act_st');
  147.     $key        = get_option('mobtheme_reg_key');
  148.     $key_hash   = get_option('mobtheme_reg_key_hash');
  149.     $stat_flag  = true;
  150.     if ((trim($statuscode) == '0') || ($statuscode == '')) {
  151.         $stat_flag = false;
  152.     } else if ((empty($key)) || (empty($key_hash))) {
  153.         $stat_flag = false;
  154.     } else if ($key_hash != encrypt_string($key)) {
  155.         $stat_flag = false;
  156.     }
  157.     if (!$stat_flag && ($statuscode || !empty($key))) {
  158.         rci_setLicenseInvalid();
  159.     }
  160.     return $stat_flag;
  161. }
  162. function rci_registerRemote($regkey)
  163. {
  164.     $status = wpfpVerifyReg($regkey);
  165.     if ($status === '1') {
  166.         rci_setLicenseValid($regkey);
  167.         return true;
  168.     } else {
  169.         rci_setLicenseInvalid();
  170.         return false;
  171.     }
  172. }
  173. function rci_validateRemote()
  174. {
  175.     $key    = get_option('mobtheme_reg_key');
  176.     $status = wpfpVerifyReg($key);
  177.     if ($status === '0') {
  178.         rci_setLicenseInvalid();
  179.         return false;
  180.     } else {
  181.         return true;
  182.     }
  183. }
  184. function rci_setLicenseInvalid()
  185. {
  186.     update_option("mobtheme_act_st", "0");
  187.     delete_option("mobtheme_reg_key");
  188. }
  189. function rci_setLicenseValid($regkey)
  190. {
  191.     $encryptedKey = encrypt_string($regkey);
  192.     update_option("mobtheme_act_st", "1");
  193.     update_option("mobtheme_reg_key", $regkey);
  194.     update_option("mobtheme_reg_key_hash", $encryptedKey);
  195. }
  196. function rci_validateAtLogin($username)
  197. {
  198.     $checkRemote = false;
  199.     $user        = get_userdatabylogin($username);
  200.     if (isset($user->ID) && $user->ID) {
  201.         $roles = get_option('wp_user_roles');
  202.         if (isset($user->wp_capabilities)) {
  203.             $userRoles = $user->wp_capabilities;
  204.             if (is_array($userRoles)) {
  205.                 $userRoles = array_keys($userRoles, true);
  206.                 $userRole  = array_shift($userRoles);
  207.                 if (isset($roles[$userRole]['capabilities'])) {
  208.                     $capabilities = $roles[$userRole]['capabilities'];
  209.                     if (in_array('manage_options', array_keys($capabilities, true))) {
  210.                         $checkRemote = true;
  211.                     }
  212.                 }
  213.             }
  214.         }
  215.     }
  216.     if ($checkRemote) {
  217.         $isActive = rci_validateLocal();
  218.         if ($isActive) {
  219.             $result = rci_validateRemote();
  220.         }
  221.     }
  222. }
  223. function upgrade()
  224. {
  225.     return get_template() . "/upgrade/notifier.xml";
  226. }
  227. function upgradefilename()
  228. {
  229.     return get_template() . "/upgrade/" . get_template() . ".zip";
  230. }
  231. add_action('wp_login', 'rci_validateAtLogin', 99999, 1);
  232. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement