public function index($page = 1) { if (mc_site_url()) { $site_url = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER['PHP_SELF']; $site_url = preg_replace("/\\/[a-z0-9]+\\.php.*/is", "", $site_url); if ($site_url != mc_site_url()) { $url = mc_site_url(); Header("Location:{$url}"); } else { if (is_numeric($page)) { if ($_GET['keyword']) { if ($_GET['stype'] == 'article') { $condition['type'] = 'article'; } elseif ($_GET['stype'] == 'publish') { $condition['type'] = 'publish'; } else { $condition['type'] = 'pro'; } $where['content'] = array('like', "%{$_GET['keyword']}%"); $where['title'] = array('like', "%{$_GET['keyword']}%"); $where['_logic'] = 'or'; $condition['_complex'] = $where; $this->page = M('page')->where($condition)->order('id desc')->page($page, mc_option('page_size'))->select(); $count = M('page')->where($condition)->count(); $this->assign('count', $count); $this->assign('page_now', $page); if ($_GET['stype'] == 'article') { $this->theme(mc_option('theme'))->display('Article/search'); } elseif ($_GET['stype'] == 'publish') { $this->theme(mc_option('theme'))->display('Post/search'); } else { $this->theme(mc_option('theme'))->display('Pro/search'); } } else { if (is_numeric($_GET['ref'])) { session('mc_reffer', $_GET['ref']); if (mc_user_id() && mc_user_id() != session('mc_reffer') && session('mc_reffer')) { $user_id = mc_user_id(); $ref_a = mc_get_meta($user_id, 'ref', true, 'user'); if (!is_numeric($ref_a)) { mc_add_meta($user_id, 'ref', session('mc_reffer'), 'user'); } } } $this->theme(mc_option('theme'))->display('Home/index'); } } else { $this->error('参数错误!'); } } } else { $site_url = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER['PHP_SELF']; $site_url = preg_replace("/\\/[a-z0-9]+\\.php.*/is", "", $site_url); $url = $site_url . '/install.php'; Header("Location:{$url}"); } }
echo mc_theme_url() . '/img/upload.jpg'; } ?> "> </div> </div> </div> </form> </div> </div> <script charset="utf-8" src="<?php echo mc_site_url(); ?> /Kindeditor/kindeditor-min.js"></script> <script charset="utf-8" src="<?php echo mc_site_url(); ?> /Kindeditor/lang/zh_CN.js"></script> <script> var editor; KindEditor.ready(function(K) { editor = K.create('textarea[name="content"]', { resizeType : 1, allowPreviewEmoticons : false, allowImageUpload : true, height : 400, uploadJson : '<?php echo U('Publish/index/upload'); ?> ', items : ['source', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'clearhtml', 'quickformat', 'selectall', '|',
public function delete_img($id) { if (is_numeric($id)) { if (mc_is_admin()) { $src = M('attached')->where("id='{$id}'")->getField('src'); M('attached')->where("id='{$id}'")->delete(); $src = str_replace(mc_site_url() . '/', '', $src); unlink($src); $this->success('删除成功'); } else { $this->error('哥们,请不要放弃治疗!', U('Home/index/index')); } } else { $this->error('参数错误!'); } }
$ymd = date("Ymd"); $save_path .= $ymd . "/"; $save_url .= $ymd . "/"; if (!file_exists($save_path)) { mkdir($save_path); } //新文件名 $new_file_name = date("YmdHis") . '_' . rand(10000, 99999) . '.' . $file_ext; //移动文件 $file_path = $save_path . $new_file_name; if (move_uploaded_file($tmp_name, $file_path) === false) { alert("上传文件失败。"); } @chmod($file_path, 0644); //$file_url = $save_url . $new_file_name; $file_url = mc_site_url() . '/' . 'Public/' . $file_ext . '/' . $ymd . '/' . $new_file_name; $file_url_db = 'Public/' . $file_ext . '/' . $ymd . '/' . $new_file_name; //mc媒体库写入 $Data = M('attached'); $attached['src'] = $file_url_db; $attached['type'] = $file_ext; $result = $Data->data($attached)->add(); header('Content-type: text/html; charset=UTF-8'); $json = new Services_JSON(); echo $json->encode(array('error' => 0, 'url' => $file_url)); exit; } function alert($msg) { header('Content-type: text/html; charset=UTF-8'); $json = new Services_JSON();
public function mysqlin() { if (mc_is_admin()) { $fileName = THINK_PATH . '../db.php'; if (!is_writeable($fileName)) { @chmod($fileName, 0777); } $json = file_get_contents($fileName); $mysqls = unserialize($json); foreach ($mysqls as $table => $mysql) { M($table)->data($mysql)->add(); } $this->success('数据导入成功!', mc_site_url()); } else { $this->error('凡人,请远离是非之地!', mc_site_url()); } }
} else { function mc_check_user_name($name) { $user_login = M('meta')->where("meta_key='user_login' AND type ='user'")->getField('meta_value', true); if (in_array($name, $user_login)) { return true; } else { return false; } } do { $user_name_test = $oid . rand(1000, 9999); } while (mc_check_user_name($user_name_test)); $user['title'] = $uinfo["nickname"]; $user['content'] = ''; $user['type'] = 'user'; $user['date'] = strtotime("now"); $result = M("page")->data($user)->add(); if ($result) { mc_add_meta($result, 'user_name', $user_name_test, 'user'); $user_pass = md5($oid . mc_option('site_key')); mc_add_meta($result, 'user_pass', $user_pass, 'user'); mc_add_meta($result, 'user_qqoid', $oid, 'user'); mc_add_meta($result, 'user_level', '1', 'user'); cookie('user_name', $user_name_test, 36000000000); cookie('user_pass', $user_pass, 36000000000); $this->success('登陆成功', mc_site_url()); } else { $this->error('登陆失败'); } }
public function index($page = 1) { if (mc_site_url()) { if (is_numeric($page)) { if ($_GET['keyword']) { if ($_GET['type'] == 'pro') { $condition['type'] = 'pro'; } elseif ($_GET['type'] == 'baobei') { $condition['type'] = 'baobei'; } elseif ($_GET['type'] == 'article') { $condition['type'] = 'article'; } elseif ($_GET['type'] == 'post') { $condition['type'] = 'publish'; } $where['content'] = array('like', "%{$_GET['keyword']}%"); $where['title'] = array('like', "%{$_GET['keyword']}%"); $where['_logic'] = 'or'; $condition['_complex'] = $where; $this->page = M('page')->where($condition)->order('id desc')->page($page, mc_option('page_size'))->select(); $count = M('page')->where($condition)->count(); $this->assign('count', $count); $this->assign('page_now', $page); if ($_GET['type'] == 'pro') { $this->theme(mc_option('theme'))->display('Pro/index'); } elseif ($_GET['type'] == 'baobei') { $this->theme(mc_option('theme'))->display('Baobei/index'); } elseif ($_GET['type'] == 'article') { $this->theme(mc_option('theme'))->display('Article/index'); } elseif ($_GET['type'] == 'post') { $this->theme(mc_option('theme'))->display('Home/search'); } else { $this->error('无效的搜索类型!'); } } else { if (is_numeric($_GET['ref'])) { session('mc_reffer', $_GET['ref']); if (mc_user_id() && mc_user_id() != session('mc_reffer') && session('mc_reffer')) { $user_id = mc_user_id(); $ref_a = mc_get_meta($user_id, 'ref', true, 'user'); if (!is_numeric($ref_a)) { mc_add_meta($user_id, 'ref', session('mc_reffer'), 'user'); } } } if (mc_option('home_mode') == 'pro') { $this->theme(mc_option('theme'))->display('Home/index-pro'); } elseif (mc_option('home_mode') == 'baobei') { $condition['type'] = 'baobei'; $date = strtotime("now"); $args_id1 = M('meta')->where("meta_key='stime' AND meta_value<'{$date}' AND type='basic'")->getField('page_id', true); $args_id2 = M('meta')->where("meta_key='etime' AND (meta_value>'{$date}' OR meta_value='') AND type='basic'")->getField('page_id', true); $args_id = array_intersect($args_id1, $args_id2); $condition['id'] = array('in', $args_id); $this->page = M('page')->where($condition)->order('date desc')->page($page, 2)->select(); $count = M('page')->where($condition)->count(); $this->assign('id', $id); $this->assign('count', $count); $this->assign('page_now', $page); $this->theme(mc_option('theme'))->display('Home/index-baobei'); } else { $condition['type'] = 'publish'; $this->page = M('page')->where($condition)->order('date desc')->page($page, 7)->select(); $count = M('page')->where($condition)->count(); $this->assign('count', $count); $this->assign('page_now', $page); $this->theme(mc_option('theme'))->display('Home/index'); } } } else { $this->error('参数错误!'); } } else { $site_url = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER['PHP_SELF']; $site_url = preg_replace("/\\/[a-z0-9]+\\.php.*/is", "", $site_url); $url = $site_url . '/install.php'; Header("Location:{$url}"); } }
?> ">查看返利记录</a> </h4> <div class="panel panel-default"> <div class="panel-body"> <?php echo mc_get_meta(mc_user_id(), 'ref', true, 'user'); ?> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label> 我的推广链接 </label> <input type="text" class="form-control text-center" value="<?php echo mc_site_url() . '?ref=' . mc_user_id(); ?> "> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label> 我的推广账号 </label> <input type="text" class="form-control text-center" value="<?php echo mc_get_meta(mc_user_id(), 'user_name', true, 'user'); ?> "> </div> </div>
function mc_get_url($page_id) { $type = mc_get_page_field($page_id, 'type'); if ($type == 'pro') { if (C('URL_MODEL') == 2) { $permalink = mc_site_url() . '/pro-' . $page_id . '.html'; } else { $permalink = U('pro/index/single?id=' . $page_id); } } elseif ($type == 'group') { $permalink = U('post/group/single?id=' . $page_id); } elseif ($type == 'article') { if (C('URL_MODEL') == 2) { $permalink = mc_site_url() . '/article-' . $page_id . '.html'; } else { $permalink = U('article/index/single?id=' . $page_id); } } elseif ($type == 'topic') { if (C('URL_MODEL') == 2) { $permalink = mc_site_url() . '/topic-' . $page_id . '.html'; } else { $permalink = U('topic/index/single?id=' . $page_id); } } elseif ($type == 'user') { $permalink = U('user/index/index?id=' . $page_id); } elseif ($type == 'publish' || $type == 'pending') { if (C('URL_MODEL') == 2) { $permalink = mc_site_url() . '/post-' . $page_id . '.html'; } else { $permalink = U('post/index/single?id=' . $page_id); } } else { $permalink = 'javascript:;'; } return $permalink; }
public function callback_url() { $signature = $_GET["signature"]; $timestamp = $_GET["timestamp"]; $nonce = $_GET["nonce"]; $echostr = $_GET["echostr"]; $token = mc_option('weixin_token'); $tmpArr = array($token, $timestamp, $nonce); // use SORT_STRING rule sort($tmpArr, SORT_STRING); $tmpStr = implode($tmpArr); $tmpStr = sha1($tmpStr); if ($tmpStr == $signature) { echo $echostr; $postStr = $GLOBALS["HTTP_RAW_POST_DATA"]; if (!empty($postStr)) { $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA); $fromUsername = $postObj->FromUserName; $toUsername = $postObj->ToUserName; $msgtype = $postObj->MsgType; $content = trim($postObj->Content); $date = strtotime("now"); if ($content != '') { $return_to = M('option')->where('type="wx_huifu" AND meta_key="' . mc_magic_in($content) . '"')->getField('meta_value'); if ($return_to != '') { $return_to_user = $return_to; } else { $return_to_user = '******' . mc_site_url(); } echo "<xml>\n<ToUserName>{$fromUsername}</ToUserName>\n<FromUserName>{$toUsername}</FromUserName>\n<CreateTime>{$date}</CreateTime>\n<MsgType>text</MsgType>\n<Content>{$return_to_user}</Content>\n</xml>"; } } } else { $this->error('Callback页面不允许直接访问!', U('home/index/index')); } }