public function todo()
 {
     $fuid = $this->uid;
     $type = intval($this->input->get_post('type'));
     $desc = urldecode($this->input->get_post('desc'));
     $desc = addslashes(strip_tags($desc));
     $email = urldecode($this->input->get_post('email'));
     if (is_email($email)) {
         if ($fuid > 0) {
             $refer = json_encode(array('ip' => getFClientIp(), 'brower' => $_SERVER['HTTP_USER_AGENT']));
             $key = MD5($fuid . "_" . $type . "_" . $refer);
             $key_value = $this->memcache_lib->get($key);
             if (empty($key_value)) {
                 $this->load->model('space/question_model', 'question_m');
                 $data = array('q_type' => question_model::TYPE_FEEDBACK, 'content' => $desc, 'q_cid ' => $type, 'uid' => $fuid, 'email' => $email, 'refer' => $refer, 'record_time' => time());
                 $q_id = $this->question_m->save_feedback($data);
                 if ($q_id > 0) {
                     $res = array('code' => 1, 'msg' => '');
                     $this->memcache_lib->set($key, 1, 3600 * 24);
                 } else {
                     $res = array('code' => $q_id, 'error' => '提交失败!');
                 }
             } else {
                 $res = array('code' => -3, 'error' => '相同的问题已经提交,谢谢你的反馈!');
             }
         } else {
             $res = array('code' => -1, 'error' => '你还没有登陆!');
         }
     } else {
         $res = array('code' => -2, 'error' => '你的邮箱格式异常!');
     }
     $this->output($res);
 }
 public function FanweService()
 {
     if (phpversion() < '5.3.0') {
         set_magic_quotes_runtime(0);
     }
     if (!defined('FANWE_ROOT')) {
         define('FANWE_ROOT', str_replace('\\', '/', substr(dirname(__FILE__), 0, -12)));
     }
     if (!file_exists(FANWE_ROOT . './public/install.lock')) {
         header('Location: install/index.php');
         exit;
     }
     define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
     define('ICONV_ENABLE', function_exists('iconv'));
     define('MB_ENABLE', function_exists('mb_convert_encoding'));
     define('EXT_OBGZIP', function_exists('ob_gzhandler'));
     define('TIMESTAMP', time());
     if (!(include FANWE_ROOT . './core/function/global.func.php')) {
         exit('not found global.func.php');
     }
     @(require FANWE_ROOT . './public/constant.global.php');
     require fimport("function/time");
     define('IS_ROBOT', checkRobot());
     if (function_exists('ini_get')) {
         $memory_limit = @ini_get('memory_limit');
         if ($memory_limit && getBytes($memory_limit) < 33554432 && function_exists('ini_set')) {
             ini_set('memory_limit', '128M');
         }
     }
     if (!$this->is_admin) {
         foreach ($GLOBALS as $key => $value) {
             if (!isset($this->allow_global[$key])) {
                 $GLOBALS[$key] = NULL;
                 unset($GLOBALS[$key]);
             }
         }
     }
     global $_FANWE;
     $_FANWE = array();
     $_FANWE['uid'] = 0;
     $_FANWE['user_name'] = '';
     $_FANWE['gid'] = 0;
     $_FANWE['sid'] = '';
     $_FANWE['form_hash'] = '';
     $_FANWE['client_ip'] = getFClientIp();
     $_FANWE['referer'] = '';
     $_FANWE['php_self'] = htmlspecialchars(getPhpSelf());
     if ($_FANWE['php_self'] === false) {
         systemError('request_tainting');
     }
     $_FANWE['module_name'] = MODULE_NAME;
     $_FANWE['module_filename'] = basename($_FANWE['php_self']);
     $_FANWE['site_url'] = '';
     $_FANWE['site_root'] = '';
     $_FANWE['site_port'] = '';
     $_FANWE['config'] = array();
     $_FANWE['setting'] = array();
     $_FANWE['user'] = array();
     $_FANWE['group'] = array();
     $_FANWE['cookie'] = array();
     $_FANWE['cache'] = array();
     $_FANWE['session'] = array();
     $_FANWE['lang'] = array();
     $_FANWE['tpl_user_formats'] = array();
     $site_path = substr($_FANWE['php_self'], 0, strrpos($_FANWE['php_self'], '/'));
     $_FANWE['site_url'] = htmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . $site_path . '/');
     $_FANWE['domain'] = htmlspecialchars($_SERVER['HTTP_HOST'] . $site_path . '/');
     $url = parse_url($_FANWE['site_url']);
     $_FANWE['site_root'] = isset($url['path']) ? $url['path'] : '';
     $_FANWE['site_port'] = empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT'];
     if (defined('SUB_DIR')) {
         $_FANWE['site_url'] = str_replace(SUB_DIR, '', $_FANWE['site_url']);
         $_FANWE['site_root'] = str_replace(SUB_DIR, '', $_FANWE['site_root']);
     }
     define('PUBLIC_ROOT', FANWE_ROOT . './public/');
     define('PUBLIC_PATH', $_FANWE['site_root'] . 'public/');
     define('SITE_URL', $_FANWE['site_root']);
     require fimport("class/cache");
     $this->cache = Cache::getInstance();
     $this->var =& $_FANWE;
     $this->buildConfig();
     $this->buildInput();
     $this->buildOutput();
 }