A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

Re: Re: Untitled - Stikked
From Unique Pintail, 6 Years ago, written in JavaScript.
This paste is a reply to Re: Untitled from Eratic Tern - view diff
Embed
  1. const config = require('./config.js');
  2. const api = require('./routes/api.js');
  3. const album = require('./routes/album.js');
  4. const express = require('express');
  5. const helmet = require('helmet');
  6. const bodyParser = require('body-parser');
  7. const RateLimit = require('express-rate-limit');
  8. const db = require('knex')(config.database);
  9. const fs = require('fs');
  10. const exphbs = require('express-handlebars');
  11. const safe = express();
  12.  
  13. require('./database/db.js')(db);
  14.  
  15. fs.existsSync('./pages/custom' ) || fs.mkdirSync('./pages/custom');
  16. fs.existsSync('./' + config.logsFolder) || fs.mkdirSync('./' + config.logsFolder);
  17. fs.existsSync('./' + config.uploads.folder) || fs.mkdirSync('./' + config.uploads.folder);
  18. fs.existsSync('./' + config.uploads.folder + '/thumbs') || fs.mkdirSync('./' + config.uploads.folder + '/thumbs');
  19. fs.existsSync('./' + config.uploads.folder + '/zips') || fs.mkdirSync('./' + config.uploads.folder + '/zips')
  20.  
  21. safe.use(helmet());
  22. safe.set('trust proxy', 1);
  23.  
  24. safe.engine('handlebars', exphbs({ defaultLayout: 'main' }));
  25. safe.set('view engine', 'handlebars');
  26. safe.enable('view cache');
  27.  
  28. let limiter = new RateLimit({ windowMs: 5000, max: 2 });
  29. safe.use('/api/login/', limiter);
  30. safe.use('/api/register/', limiter);
  31.  
  32. safe.use(bodyParser.urlencoded({ extended: true }));
  33. safe.use(bodyParser.json());
  34.  
  35. if (config.serveFilesWithNode) {
  36.         safe.use('/', express.static(config.uploads.folder));
  37. }
  38.  
  39. safe.use('/', express.static('./public'));
  40. safe.use('/', album);
  41. safe.use('/api', api);
  42.  
  43. for (let page of config.pages) {
  44.         let root = './pages/';
  45.         if (fs.existsSync(`./pages/custom/${page}.html`)) {
  46.                 root = './pages/custom/';
  47.         }
  48.         if (page === 'home') {
  49.                 safe.get('/', (req, res, next) => res.sendFile(`${page}.html`, { root: root }));
  50.         } else {
  51.                 safe.get(`/${page}`, (req, res, next) => res.sendFile(`${page}.html`, { root: root }));
  52.         }
  53. }
  54.  
  55. safe.use((req, res, next) => res.status(404).sendFile('404.html', { root: './pages/error/' }));
  56. safe.use((req, res, next) => res.status(500).sendFile('500.html', { root: './pages/error/' }));
  57.  
  58. safe.listen(config.port, () => console.log(`lolisafe started on port ${config.port}`));
  59.