emlog 是完全开源的软件,但编写,支持和分发仍然需要花费很多时间和费用。投我以桃,报之以李,作为付费贡献者你将获得一个 pro 版本的注册码,用于解锁 pro 的全部功能,你的支持也将帮助 emlog 变的更好。
【上面是作者原话,虽然我并未使用 Emlog,如果正式使用推荐捐赠获得注册码注册,仅测试可用下方办法去除】
去除商店验证位置: /include/lib/register.php
<?php
/**
* register check
* @package EMLOG (www.emlog.net)
*/
class Register {
/**
* Check user is registered on the local side
*/
public static function isRegLocal() {
$CACHE = Cache::getInstance();
$options_cache = $CACHE->readCache('options');
$emkey = $options_cache['emkey'] ?? '';
//这里注释掉
/*if (empty($emkey)) {
return false;
}*/
return true;
}
/**
* Check user is registered on the server side
*/
public static function isRegServer() {
//这里注释掉
/*$CACHE = Cache::getInstance();
$options_cache = $CACHE->readCache('options');
$emkey = $options_cache['emkey'] ?? '';
return self::checkEmKey($emkey);*/
return true;
}
/**
* check emkey
*/
public static function checkEmKey($emkey) {
//这里注释掉
/*if (empty($emkey)) {
return false;
}
$emcurl = new EmCurl();
$emcurl->setPost(['emkey' => $emkey]);
$emcurl->request(OFFICIAL_SERVICE_HOST . 'proauth/register');
if ($emcurl->getHttpStatus() !== 200) {
return false;
}
$response = $emcurl->getRespone();
$response = json_decode($response, 1);
if ($response['code'] !== 200) {
$CACHE = Cache::getInstance();
Option::updateOption('emkey', '');
$CACHE->updateCache('options');
return false;
}*/
return true;
}
}
去除未注册提示位置:/include/lib/option.php
<?php
/**
* 配置项
* @package EMLOG (www.emlog.net)
*/
class Option {
const EMLOG_VERSION = 'pro 体验版'; //版本编号
const EMLOG_VERSION_TIMESTAMP = 9999999999; //版本时间戳
const ICON_MAX_W = 160; //头像缩略图最大宽
const ICON_MAX_H = 160; //头像缩略图最大高
const UPLOADFILE_PATH = '../content/uploadfile/';//上传路径
static function get($option) {
$CACHE = Cache::getInstance();
$options_cache = $CACHE->readCache('options');
if (isset($options_cache[$option])) {
switch ($option) {
case 'active_plugins':
case 'navibar':
case 'widget_title':
case 'custom_widget':
case 'widgets1':
case 'custom_topimgs':
if (!empty($options_cache[$option])) {
return @unserialize($options_cache[$option]);
} else {
return array();
}
break;
case 'blogurl':
if ($options_cache['detect_url'] == 'y') {
return realUrl();
} else {
return $options_cache['blogurl'];
}
break;
default:
return $options_cache[$option];
break;
}
}
}
static function getAll() {
$CACHE = Cache::getInstance();
$options_cache = $CACHE->readCache('options');
$options_cache['site_title'] = $options_cache['site_title'] ?: $options_cache['blogname'];
$options_cache['site_description'] = $options_cache['site_description'] ?: $options_cache['bloginfo'];
//这里注释掉
/*if (empty($options_cache['emkey'])) {
$options_cache['footer_info'] .= ' 未注册的PRO版本';
$options_cache['site_title'] = '未注册的PRO版本' . $options_cache['site_title'];
}*/
return $options_cache;
}
static function getRoutingTable() {
$routingtable = array(
array(
'model' => 'calendar',
'method' => 'generate',
'reg_0' => '|^.*/\?action=cal|',
),
array(
'model' => 'Log_Controller',
'method' => 'displayContent',
'reg_0' => '|^.*/\?(post)=(\d+)(&(comment-page)=(\d+))?([\?&].*)?$|',
'reg_1' => '|^.*/(post)-(\d+)\.html(/(comment-page)-(\d+))?/?([\?&].*)?$|',
'reg_2' => '|^.*/(post)/(\d+)(/(comment-page)-(\d+))?/?$|',
'reg_3' => '|^/([^\./\?=]+)(\.html)?(/(comment-page)-(\d+))?/?([\?&].*)?$|',
),
array(
'model' => 'Record_Controller',
'method' => 'display',
'reg_0' => '|^.*/\?(record)=(\d{6,8})(&(page)=(\d+))?([\?&].*)?$|',
'reg' => '|^.*/(record)/(\d{6,8})/?((page)/(\d+))?/?([\?&].*)?$|',
),
array(
'model' => 'Sort_Controller',
'method' => 'display',
'reg_0' => '|^.*/\?(sort)=(\d+)(&(page)=(\d+))?([\?&].*)?$|',
'reg' => '|^.*/(sort)/([^\./\?=]+)/?((page)/(\d+))?/?([\?&].*)?$|',
),
array(
'model' => 'Tag_Controller',
'method' => 'display',
'reg_0' => '|^.*/\?(tag)=([^&]+)(&(page)=(\d+))?([\?&].*)?$|',
'reg' => '|^.*/(tag)/([^/?]+)/?((page)/(\d+))?/?([\?&].*)?$|',
),
array(
'model' => 'Author_Controller',
'method' => 'display',
'reg_0' => '|^.*/\?(author)=(\d+)(&(page)=(\d+))?([\?&].*)?$|',
'reg' => '|^.*/(author)/(\d+)/?((page)/(\d+))?/?([\?&].*)?$|',
),
array(
'model' => 'Log_Controller',
'method' => 'display',
'reg_0' => '|^.*/\?(page)=(\d+)([\?&].*)?$|',
'reg' => '|^.*/(page)/(\d+)/?([\?&].*)?$|',
),
array(
'model' => 'Search_Controller',
'method' => 'display',
'reg_0' => '|^.*/\?(keyword)=([^/&]+)(&(page)=(\d+))?([\?&].*)?$|',
),
array(
'model' => 'Comment_Controller',
'method' => 'addComment',
'reg_0' => '|^.*/\?(action)=(addcom)([\?&].*)?$|',
),
array(
'model' => 'Plugin_Controller',
'method' => 'loadPluginShow',
'reg_0' => '|^.*/\?(plugin)=([\w\-]+).*([\?&].*)?$|',
),
array(
'model' => 'Log_Controller',
'method' => 'displayContent',
'reg_0' => '|^.*?/([^/\.=\?]+)(\.html)?(/(comment-page)-(\d+))?/?([\?&].*)?$|',
),
array(
'model' => 'Log_Controller',
'method' => 'display',
'reg_0' => '|^/?([\?&].*)?$|',
),
);
return $routingtable;
}
/**
* 获取允许上传的文件类型
*/
static function getAttType() {
return explode(',', self::get('att_type'));
}
/**
* 获取上传最大限制,单位字节
*/
static function getAttMaxSize() {
return self::get('att_maxsize') * 1024;
}
/**
* 获取widget组件标题
*/
static function getWidgetTitle() {
return [
'blogger' => '个人资料',
'calendar' => '日历',
'tag' => '标签',
'sort' => '分类',
'archive' => '存档',
'newcomm' => '最新评论',
'newlog' => '最新文章',
'hotlog' => '热门文章',
'link' => '链接',
'search' => '搜索',
'custom_text' => '自定义组件'
];
}
/**
* 获取初始安装时的widget列表
*/
static function getDefWidget() {
return ['blogger', 'newcomm', 'link', 'search'];
}
/**
* 获取初始安装时的插件
*/
static function getDefPlugin() {
return ['tips/tips.php'];
}
/**
* 更新配置选项
* @param $name
* @param $value
* @param $isSyntax 更新值是否为一个表达式
*/
static function updateOption($name, $value, $isSyntax = false) {
$DB = Database::getInstance();
$value = $isSyntax ? $value : "'$value'";
$sql = 'INSERT INTO ' . DB_PREFIX . "options (option_name, option_value) values ('$name', $value) ON DUPLICATE KEY UPDATE option_value=$value, option_name='$name'";
$DB->query($sql);
}
}
去除重定向位置:/admin/globals.php
<?php
/**
* 后台全局项加载
* @package EMLOG (www.emlog.net)
*/
/**
* @var string $action
* @var object $CACHE
*/
require_once '../init.php';
$sta_cache = $CACHE->readCache('sta');
$user_cache = $CACHE->readCache('user');
$action = isset($_GET['action']) ? addslashes($_GET['action']) : '';
loginAuth::checkLogin();
User::checkRolePermission();
//这里注释掉
/*if (!Register::isRegLocal() && mt_rand(1, 15) === 10) {
emDirect("auth.php");
}*/
去除重定向位置:/admin/globals.php
<?php
/**
* 后台全局项加载
* @package EMLOG (www.emlog.net)
*/
/**
* @var string $action
* @var object $CACHE
*/
require_once '../init.php';
$sta_cache = $CACHE->readCache('sta');
$user_cache = $CACHE->readCache('user');
$action = isset($_GET['action']) ? addslashes($_GET['action']) : '';
loginAuth::checkLogin();
User::checkRolePermission();
//这里注释掉
/*if (!Register::isRegLocal() && mt_rand(1, 15) === 10) {
emDirect("auth.php");
}*/
新版本 pro 2.2.8 可以把函数
public static function clean() {
$CACHE = Cache::getInstance();
Option::updateOption('emkey', '');
Option::updateOption('emkey_type', '');
$CACHE->updateCache('options');
}