Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function license(array $options = array(), cmstop $cmstop) {
- if (defined("INTERNAL")) {
- return true;
- }
- $buy_license_message = "<br />\xe8\xaf\xb7\xe8\x81\x94\xe7\xb3\xbb <a href=\"http://www.cmstop.com/\" target=\"_blank\">CmsTop</a> \xe5\xae\x98\xe6\x96\xb9\xe8\xb4\xad\xe4\xb9\xb0\xe6\x8e\x88\xe6\x9d\x83";
- static $license;
- if (is_null($license)) {
- $file = ROOT_PATH . "license";
- if (!is_file($file)) {
- $cmstop->showmessage("\xe6\x8e\x88\xe6\x9d\x83\xe6\x96\x87\xe4\xbb\xb6\xe4\xb8\x8d\xe5\xad\x98\xe5\x9c\xa8" . $buy_license_message);
- }
- if (!is_readable($file) || !strlen($license = file_get_contents($file))) {
- $cmstop->showmessage("\xe6\x97\xa0\xe6\xb3\x95\xe8\xaf\xbb\xe5\x8f\x96\xe6\x8e\x88\xe6\x9d\x83\xe6\x96\x87\xe4\xbb\xb6");
- }
- $key = "[email protected]";
- $license = strrev($license);
- $license = base64_decode($license);
- $license = substr($license, 10, -15 - strlen($key));
- $license = cmstop::licenseDecode($license, $key);
- $license = explode("|", $license);
- }
- if (empty($license)) {
- $cmstop->showmessage("\xe6\x82\xa8\xe7\x9a\x84\xe6\x8e\x88\xe6\x9d\x83\xe6\x96\x87\xe4\xbb\xb6\xe6\x9c\x89\xe8\xaf\xaf" . $buy_license_message);
- }
- $mobile_expires = $license[9];
- $version = $license[8];
- $contents = $license[7];
- $expires = $license[6];
- $admins = $license[5];
- $specials = $license[4];
- $admindomain = $license[3];
- $ip = $license[2];
- $domain = $license[1];
- $apps = $license[0];
- if (!$version) {
- $cmstop->showmessage("\xe6\x82\xa8\xe7\x9a\x84\xe6\x8e\x88\xe6\x9d\x83\xe6\x96\x87\xe4\xbb\xb6\xe6\x9c\x89\xe8\xaf\xaf" . $buy_license_message);
- }
- static $internal_validate;
- if (!$internal_validate) {
- if ($expires && $expires < time()) {
- $cmstop->showmessage("\xe6\x82\xa8\xe7\x9a\x84\xe6\x8e\x88\xe6\x9d\x83\xe5\xb7\xb2\xe8\xbf\x87\xe6\x9c\x9f" . $buy_license_message);
- }
- $host = $_SERVER["SERVER_NAME"];
- if (empty($host)) {
- $host = $_SERVER["HTTP_HOST"];
- }
- if (md5($host) !== $admindomain) {
- $cmstop->showmessage("\xe6\x82\xa8\xe5\xbd\x93\xe5\x89\x8d\xe4\xbd\xbf\xe7\x94\xa8\xe7\x9a\x84\xe5\x9f\x9f\xe5\x90\x8d\xe4\xb8\x8e\xe6\x8e\x88\xe6\x9d\x83\xe5\x9f\x9f\xe5\x90\x8d\xe4\xb8\x8d\xe7\xac\xa6" . $buy_license_message);
- }
- $ip = explode(",", $ip);
- $addr = $_SERVER["SERVER_ADDR"];
- if (empty($addr)) {
- $addr = $_SERVER["LOCAL_ADDR"];
- }
- if (!in_array($addr, $ip)) {
- $cmstop->showmessage("\xe6\x82\xa8\xe5\xbd\x93\xe5\x89\x8d\xe4\xbd\xbf\xe7\x94\xa8\xe7\x9a\x84 IP \xe4\xb8\x8e\xe6\x8e\x88\xe6\x9d\x83 IP \xe4\xb8\x8d\xe7\xac\xa6" . $buy_license_message);
- }
- $apps = explode(",", $apps);
- $license_apps = (array("interview", "survey", "magazine", "paper", "dms", "mobile", "baoliao"));
- if (in_array($cmstop->app, $license_apps) && !in_array($cmstop->app, $apps)) {
- $cmstop->showmessage("\xe5\xbd\x93\xe5\x89\x8d\xe5\xba\x94\xe7\x94\xa8\xe6\x9c\xaa\xe8\xb4\xad\xe4\xb9\xb0\xe6\x8e\x88\xe6\x9d\x83" . $buy_license_message);
- }
- $aca = '' . $cmstop->app . "/" . $cmstop->controller . "/" . $cmstop->action;
- if ($admins && ($admins_in_db = factory::db()->get("SELECT COUNT(*) AS `total` FROM `#table_admin`")) && ($admins_in_db = intval($admins_in_db["total"]))) {
- if ($aca == "system/administrator/add" && $admins < $admins_in_db + 1) {
- $cmstop->showmessage("\xe7\xb3\xbb\xe7\xbb\x9f\xe4\xb8\xad\xe7\x9a\x84\xe7\xae\xa1\xe7\x90\x86\xe5\x91\x98\xe6\x95\xb0\xe8\xbe\xbe\xe5\x88\xb0\xe4\xba\x86\xe6\x82\xa8\xe7\x9a\x84\xe6\x8e\x88\xe6\x9d\x83\xe4\xb8\x8a\xe9\x99\x90" . $buy_license_message);
- }
- else {
- if ($admins < $admins_in_db) {
- $cmstop->showmessage("\xe7\xb3\xbb\xe7\xbb\x9f\xe4\xb8\xad\xe7\x9a\x84\xe7\xae\xa1\xe7\x90\x86\xe5\x91\x98\xe6\x95\xb0\xe8\xb6\x85\xe5\x87\xba\xe4\xba\x86\xe6\x82\xa8\xe7\x9a\x84\xe6\x8e\x88\xe6\x9d\x83\xe6\x95\xb0\xe9\x87\x8f" . $buy_license_message);
- }
- }
- }
- if ($specials && ('' . $cmstop->app . "/" . $cmstop->controller == "special/online" || $aca == "special/special/add")) {
- $speicals_sql = "SELECT COUNT(*) AS `total` FROM `#table_special`";
- if ($version != "special") {
- $speicals_sql .= "s LEFT JOIN `#table_content` c ON s.`contentid` = c.`contentid`\n WHERE c.`created` >= " . strtotime(date("Y-01-01 00:00:00", TIME));
- }
- $specials_in_db = factory::db()->get($speicals_sql);
- if ($specials_in_db && ($specials_in_db = intval($specials_in_db["total"]))) {
- if ($aca == "special/special/add" && $specials < $specials_in_db + 1) {
- $cmstop->showmessage("\xe7\xb3\xbb\xe7\xbb\x9f\xe4\xb8\xad\xe7\x9a\x84\xe4\xb8\x93\xe9\xa2\x98\xe6\x95\xb0\xe8\xbe\xbe\xe5\x88\xb0\xe4\xba\x86\xe6\x82\xa8\xe7\x9a\x84\xe6\x8e\x88\xe6\x9d\x83\xe4\xb8\x8a\xe9\x99\x90" . $buy_license_message);
- }
- else {
- if ($specials < $specials_in_db) {
- $cmstop->showmessage("\xe7\xb3\xbb\xe7\xbb\x9f\xe4\xb8\xad\xe7\x9a\x84\xe4\xb8\x93\xe9\xa2\x98\xe6\x95\xb0\xe8\xb6\x85\xe5\x87\xba\xe4\xba\x86\xe6\x82\xa8\xe7\x9a\x84\xe6\x8e\x88\xe6\x9d\x83\xe6\x95\xb0\xe9\x87\x8f" . $buy_license_message);
- }
- }
- }
- }
- if ($mobile_expires) {
- define("MOBILE_EXPIRES", $mobile_expires);
- }
- define("CMSTOP_VERSION", "CmsTop " . ucfirst($version));
- $internal_validate = true;
- }
- if ($contents && !empty($options["contents"]) && $contents * 10000 < $options["contents"]) {
- $cmstop->showmessage("\xe7\xb3\xbb\xe7\xbb\x9f\xe4\xb8\xad\xe7\x9a\x84\xe7\xa8\xbf\xe4\xbb\xb6\xe6\x95\xb0\xe8\xbe\xbe\xe5\x88\xb0\xe4\xba\x86\xe6\x82\xa8\xe7\x9a\x84\xe6\x8e\x88\xe6\x9d\x83\xe4\xb8\x8a\xe9\x99\x90" . $buy_license_message);
- }
- return true;
- }
- function admin_log($app, $controller, $action) {
- $log = loader::model("admin/admin_log", "system");
- $log->insert(array("aca" => $app . "/admin/" . $controller . "/" . $action, "dur" => sprintf("%7.3f", microtime(true) - MICROTIME)));
- unset($log);
- unset($log);
- }
- ...............................................................
- ...................................
- ...........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement