public function index()
 {
     if (mc_user_id()) {
         if (mc_is_admin()) {
             $mao10cms = 'http://www.mao10.com';
             $version = unserialize(file_get_contents($mao10cms . "/site_update/version.txt"));
             if (mc_option('site_version') == '') {
                 mc_add_option('site_version', '3.3');
             }
             if ($_GET['update'] == 'mao10cms') {
                 $special1 = unserialize(file_get_contents($mao10cms . "/site_update/special1.txt"));
                 //文件夹
                 $special2 = unserialize(file_get_contents($mao10cms . "/site_update/special2.txt"));
                 //文件和升级文件名
                 foreach ($special1 as $val) {
                     $filename = THINK_PATH . '../' . $val;
                     if (!is_dir($filename)) {
                         mkdir($filename, 0777);
                     } else {
                         @chmod($filename, 0777);
                     }
                 }
                 foreach ($special2 as $val) {
                     list($name1, $name2) = explode('|', $val);
                     $filename = THINK_PATH . '../' . $name1;
                     $file_code = file_get_contents($mao10cms . "/site_update/patch/" . $name2);
                     if (!file_exists($filename)) {
                         if (!is_writeable($filename)) {
                             @chmod($filename, 0777);
                         }
                         file_put_contents($filename, $file_code);
                     }
                 }
                 mc_update_option('site_version', $version['ver']);
             }
             $this->assign('version', $version);
             $this->theme('admin')->display('Control/index');
         } else {
             $this->error('您没有权限访问此页面!');
         }
     } else {
         $this->success('请先登陆', U('User/login/index'));
     }
 }
 public function huifu($page = 1)
 {
     if (mc_user_id()) {
         if (mc_is_admin()) {
             if ($_POST['msg'] && $_POST['return']) {
                 mc_add_option($_POST['msg'], $_POST['return'], 'wx_huifu');
                 $this->success('添加成功!', U('control/weixin/huifu'));
             } elseif ($_POST['del']) {
                 M('option')->where("id = '" . $_POST['del'] . "'")->delete();
                 $this->success('删除成功!', U('control/weixin/huifu'));
             } else {
                 $this->theme('admin')->display('Control/huifu');
             }
         } else {
             $this->error('您没有权限访问此页面!');
         }
     } else {
         $this->success('请先登陆', U('User/login/index'));
     }
 }
 public function ip_false($id)
 {
     if (is_numeric($id)) {
         if (mc_is_admin()) {
             if (mc_get_meta($id, 'user_level', true, 'user') != 10) {
                 $ip_array = M('action')->where("page_id='{$id}' AND action_key='ip'")->getField('action_value', true);
                 if ($ip_array) {
                     foreach ($ip_array as $ip) {
                         mc_add_option('ip_false', $ip, 'user');
                     }
                 }
                 mc_delete_page($id);
                 $this->success('操作成功', U('Home/index/index'));
             } else {
                 $this->error('请不要伤害管理员');
             }
         } else {
             $this->error('哥们,请不要放弃治疗!', U('Home/index/index'));
         }
     } else {
         $this->error('参数错误!');
     }
 }
 public function site_nav()
 {
     if (mc_is_admin()) {
         if ($_POST['nav_control']) {
             mc_add_option(I('param.nav_text'), I('param.nav_link'), 'nav');
             $this->success('保存成功', U('Home/index/index'));
         } else {
             $this->error('提交参数错误!');
         }
     } else {
         $this->success('请先登陆', U('User/login/index'));
     }
 }
 public function site_nav2()
 {
     if (mc_is_admin()) {
         if ($_POST['nav_control']) {
             if ($_POST['nav_blank'] > 0) {
                 mc_add_option(I('param.nav_text'), I('param.nav_link'), 'nav4');
             } else {
                 mc_add_option(I('param.nav_text'), I('param.nav_link'), 'nav3');
             }
             $this->success('保存成功');
         } else {
             $this->error('提交参数错误!');
         }
     } else {
         $this->success('请先登陆');
     }
 }