Пример #1
0
     }
     if ($config['image_reject_repost']) {
         if ($p = getPostByHash($post['filehash'])) {
             undoImage($post);
             error(sprintf($config['error']['fileexists'], ($post['mod'] ? $config['root'] . $config['file_mod'] . '?/' : $config['root']) . ($board['dir'] . $config['dir']['res'] . ($p['thread'] ? $p['thread'] . '.html#' . $p['id'] : $p['id'] . '.html'))));
         }
     } else {
         if (!$post['op'] && $config['image_reject_repost_in_thread']) {
             if ($p = getPostByHashInThread($post['filehash'], $post['thread'])) {
                 undoImage($post);
                 error(sprintf($config['error']['fileexistsinthread'], ($post['mod'] ? $config['root'] . $config['file_mod'] . '?/' : $config['root']) . ($board['dir'] . $config['dir']['res'] . ($p['thread'] ? $p['thread'] . '.html#' . $p['id'] : $p['id'] . '.html'))));
             }
         }
     }
 }
 if (!hasPermission($config['mod']['postunoriginal'], $board['uri']) && $config['robot_enable'] && checkRobot($post['body_nomarkup'])) {
     undoImage($post);
     if ($config['robot_mute']) {
         error(sprintf($config['error']['muted'], mute()));
     } else {
         error($config['error']['unoriginal']);
     }
 }
 // Remove board directories before inserting them into the database.
 if ($post['has_file']) {
     foreach ($post['files'] as $key => &$file) {
         $file['file_path'] = $file['file'];
         $file['thumb_path'] = $file['thumb'];
         $file['file'] = mb_substr($file['file'], mb_strlen($config['dir']['img_root'] . $board['dir'] . $config['dir']['img']));
         if ($file['is_an_image'] && $file['thumb'] != 'spoiler') {
             $file['thumb'] = mb_substr($file['thumb'], mb_strlen($config['dir']['img_root'] . $board['dir'] . $config['dir']['thumb']));
 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();
 }