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

main.php - Stikked
From Claude, 13 Years ago, written in PHP.
Embed
  1. <?php
  2. /**
  3.  * Class and Function List:
  4.  * Function list:
  5.  * - __construct()
  6.  * - _form_prep()
  7.  * - index()
  8.  * - raw()
  9.  * - download()
  10.  * - lists()
  11.  * - view()
  12.  * - _view_options_prep()
  13.  * - view_options()
  14.  * - cron()
  15.  * - about()
  16.  * - _valid_lang()
  17.  * Classes list:
  18.  * - Main extends CI_Controller
  19.  */
  20.  
  21. class Main extends CI_Controller
  22. {
  23.        
  24.         function __construct()
  25.         {
  26.                 parent::__construct();
  27.                 $this->load->model('languages');
  28.                
  29.                 if (!$this->db->table_exists('ci_sessions'))
  30.                 {
  31.                         $this->load->dbforge();
  32.                         $fields = array(
  33.                                 'session_id' => array(
  34.                                         'type' => 'VARCHAR',
  35.                                         'constraint' => 40,
  36.                                         'default' => 0,
  37.                                 ) ,
  38.                                 'ip_address' => array(
  39.                                         'type' => 'VARCHAR',
  40.                                         'constraint' => 16,
  41.                                         'default' => 0,
  42.                                 ) ,
  43.                                 'user_agent' => array(
  44.                                         'type' => 'VARCHAR',
  45.                                         'constraint' => 50,
  46.                                 ) ,
  47.                                 'last_activity' => array(
  48.                                         'type' => 'INT',
  49.                                         'constraint' => 10,
  50.                                         'unsigned' => TRUE,
  51.                                         'default' => 0,
  52.                                 ) ,
  53.                                 'session_data' => array(
  54.                                         'type' => 'TEXT',
  55.                                 ) ,
  56.                         );
  57.                         $this->dbforge->add_field($fields);
  58.                         $this->dbforge->add_key('session_id', true);
  59.                         $this->dbforge->create_table('ci_sessions', true);
  60.                 }
  61.                
  62.                 if (!$this->db->table_exists('pastes'))
  63.                 {
  64.                         $this->load->dbforge();
  65.                         $fields = array(
  66.                                 'id' => array(
  67.                                         'type' => 'INT',
  68.                                         'constraint' => 10,
  69.                                         'auto_increment' => TRUE,
  70.                                 ) ,
  71.                                 'pid' => array(
  72.                                         'type' => 'VARCHAR',
  73.                                         'constraint' => 8,
  74.                                 ) ,
  75.                                 'title' => array(
  76.                                         'type' => 'VARCHAR',
  77.                                         'constraint' => 32,
  78.                                 ) ,
  79.                                 'name' => array(
  80.                                         'type' => 'VARCHAR',
  81.                                         'constraint' => 32,
  82.                                 ) ,
  83.                                 'lang' => array(
  84.                                         'type' => 'VARCHAR',
  85.                                         'constraint' => 32,
  86.                                 ) ,
  87.                                 'private' => array(
  88.                                         'type' => 'TINYINT',
  89.                                         'constraint' => 1,
  90.                                 ) ,
  91.                                 'paste' => array(
  92.                                         'type' => 'LONGTEXT',
  93.                                 ) ,
  94.                                 'raw' => array(
  95.                                         'type' => 'LONGTEXT',
  96.                                 ) ,
  97.                                 'created' => array(
  98.                                         'type' => 'INT',
  99.                                         'constraint' => 10,
  100.                                 ) ,
  101.                                 'expire' => array(
  102.                                         'type' => 'INT',
  103.                                         'constraint' => 10,
  104.                                         'default' => 0,
  105.                                 ) ,
  106.                                 'toexpire' => array(
  107.                                         'type' => 'TINYINT',
  108.                                         'constraint' => 1,
  109.                                         'unsigned' => TRUE,
  110.                                 ) ,
  111.                                 'snipurl' => array(
  112.                                         'type' => 'VARCHAR',
  113.                                         'constraint' => 64,
  114.                                         'default' => 0,
  115.                                 ) ,
  116.                                 'replyto' => array(
  117.                                         'type' => 'VARCHAR',
  118.                                         'constraint' => 8,
  119.                                 ) ,
  120.                         );
  121.                         $this->dbforge->add_field($fields);
  122.                         $this->dbforge->add_key('id', true);
  123.                         $this->dbforge->create_table('pastes', true);
  124.                 }
  125.         }
  126.        
  127.         function _form_prep($lang = 'php', $title = '', $paste = '', $reply = false)
  128.         {
  129.                 $this->load->model('languages');
  130.                 $this->load->helper('form');
  131.                 $data['languages'] = $this->languages->get_languages();
  132.                
  133.                 if (!$this->input->post('submit'))
  134.                 {
  135.                        
  136.                         if ($this->db_session->flashdata('settings_changed'))
  137.                         {
  138.                                 $data['status_message'] = 'Settings successfully changed';
  139.                         }
  140.                         $data['name_set'] = $this->db_session->userdata('name');
  141.                         $data['expire_set'] = $this->db_session->userdata('expire');
  142.                         $data['acopy_set'] = $this->db_session->userdata('acopy');
  143.                         $data['private_set'] = $this->db_session->userdata('private');
  144.                         $data['snipurl_set'] = $this->db_session->userdata('snipurl');
  145.                         $data['remember_set'] = $this->db_session->userdata('remember');
  146.                         $data['paste_set'] = $paste;
  147.                         $data['title_set'] = $title;
  148.                         $data['reply'] = $reply;
  149.                        
  150.                         if ($lang != 'php' or ($lang == 'php' and $this->db_session->userdata('lang') == false))
  151.                         {
  152.                                 $data['lang_set'] = $lang;
  153.                         }
  154.                         elseif ($this->db_session->userdata('lang'))
  155.                         {
  156.                                 $data['lang_set'] = $this->db_session->userdata('lang');
  157.                         }
  158.                 }
  159.                 else
  160.                 {
  161.                         $data['name_set'] = $this->input->post('name');
  162.                         $data['expire_set'] = $this->input->post('expire');
  163.                         $data['acopy_set'] = $this->input->post('acopy');
  164.                         $data['private_set'] = $this->input->post('private');
  165.                         $data['snipurl_set'] = $this->input->post('snipurl');
  166.                         $data['remember_set'] = $this->input->post('remember');
  167.                         $data['paste_set'] = $this->input->post('paste');
  168.                         $data['title_set'] = $this->input->post('title');
  169.                         $data['reply'] = $this->input->post('reply');
  170.                         $data['lang_set'] = $this->input->post('lang');
  171.                 }
  172.                 return $data;
  173.         }
  174.        
  175.         function index()
  176.         {
  177.                
  178.                 if (!$this->input->post('submit'))
  179.                 {
  180.                         $data = $this->_form_prep();
  181.                         $this->load->view('home', $data);
  182.                 }
  183.                 else
  184.                 {
  185.                         $this->load->model('pastes');
  186.                         $this->load->library('form_validation');
  187.  
  188.                         //rules
  189.                         $rules = array(
  190.                                 array(
  191.                                         'field' => 'code',
  192.                                         'label' => 'Main Paste',
  193.                                         'rules' => 'required',
  194.                                 ) ,
  195.                                 array(
  196.                                         'field' => 'lang',
  197.                                         'label' => 'Language',
  198.                                         'rules' => 'min_length[1]|required|callback__valid_lang',
  199.                                 ) ,
  200.                         );
  201.  
  202.                         //form validation
  203.                         $this->form_validation->set_rules($rules);
  204.                         $this->form_validation->set_message('min_length', 'The %s field can not be empty');
  205.                         $this->form_validation->set_error_delimiters('<div class="message error"><div class="container">', '</div></div>');
  206.                        
  207.                         if ($this->form_validation->run() == FALSE)
  208.                         {
  209.                                 $data = $this->_form_prep();
  210.                                 $this->load->view('home', $data);
  211.                         }
  212.                         else
  213.                         {
  214.                                
  215.                                 if ($this->input->post('acopy'))
  216.                                 {
  217.                                         $this->db_session->set_flashdata('acopy', 'true');
  218.                                 }
  219.                                
  220.                                 if ($this->input->post('remember') and $this->input->post('reply') == false)
  221.                                 {
  222.                                         $user_data = array(
  223.                                                 'name' => $this->input->post('name') ,
  224.                                                 'lang' => $this->input->post('lang') ,
  225.                                                 'expire' => $this->input->post('expire') ,
  226.                                                 'acopy' => $this->input->post('acopy') ,
  227.                                                 'snipurl' => $this->input->post('snipurl') ,
  228.                                                 'private' => $this->input->post('private') ,
  229.                                                 'remember' => $this->input->post('remember')
  230.                                         );
  231.                                         $this->db_session->set_userdata($user_data);
  232.                                 }
  233.                                
  234.                                 if ($this->input->post('remember') == false and $this->db_session->userdata("remember") == 1)
  235.                                 {
  236.                                         $user_data = array(
  237.                                                 'name' => '',
  238.                                                 'lang' => 'php',
  239.                                                 'expire' => '0',
  240.                                                 'acopy' => '0',
  241.                                                 'snipurl' => '0',
  242.                                                 'private' => '0',
  243.                                                 'remember' => '0'
  244.                                         );
  245.                                         $this->db_session->unset_userdata($user_data);
  246.                                 }
  247.                                 redirect($this->pastes->createPaste());
  248.                         }
  249.                 }
  250.         }
  251.        
  252.         function raw()
  253.         {
  254.                 $this->load->model('pastes');
  255.                 $check = $this->pastes->checkPaste(3);
  256.                
  257.                 if ($check)
  258.                 {
  259.                         $data = $this->pastes->getPaste(3);
  260.                         $this->load->view('view/raw', $data);
  261.                 }
  262.                 else
  263.                 {
  264.                         show_404();
  265.                 }
  266.         }
  267.        
  268.         function download()
  269.         {
  270.                 $this->load->model('pastes');
  271.                 $check = $this->pastes->checkPaste(3);
  272.                
  273.                 if ($check)
  274.                 {
  275.                         $data = $this->pastes->getPaste(3);
  276.                         $this->load->view('view/download', $data);
  277.                 }
  278.                 else
  279.                 {
  280.                         show_404();
  281.                 }
  282.         }
  283.        
  284.         function lists()
  285.         {
  286.                 $this->load->model('pastes');
  287.                 $data = $this->pastes->getLists();
  288.                 $this->load->view('list', $data);
  289.         }
  290.        
  291.         function view()
  292.         {
  293.                 $this->load->model('pastes');
  294.                 $check = $this->pastes->checkPaste(2);
  295.                
  296.                 if ($check)
  297.                 {
  298.                        
  299.                         if ($this->db_session->userdata('view_raw'))
  300.                         {
  301.                                 $this->db_session->keep_flashdata('acopy');
  302.                                 redirect('view/raw/' . $this->uri->segment(2));
  303.                         }
  304.                         $data = $this->pastes->getPaste(2, true);
  305.                         $data['reply_form'] = $this->_form_prep($data['lang_code'], "RE: " . $data['title'], $data['raw'], $data['pid']);
  306.                        
  307.                         if ($this->db_session->userdata('full_width'))
  308.                         {
  309.                                 $data['full_width'] = true;
  310.                         }
  311.                         else
  312.                         {
  313.                                 $data['full_width'] = false;
  314.                         }
  315.                         $this->load->view('view/view', $data);
  316.                 }
  317.                 else
  318.                 {
  319.                         show_404();
  320.                 }
  321.         }
  322.        
  323.         function _view_options_prep()
  324.         {
  325.                 $this->load->helper('form');
  326.                
  327.                 if ($this->db_session->userdata('remember_view') > 0)
  328.                 {
  329.                         $data['full_width_set'] = $this->db_session->userdata('full_width');
  330.                         $data['view_raw_set'] = $this->db_session->userdata('view_raw');
  331.                 }
  332.                 else
  333.                 {
  334.                         $data['full_width_set'] = false;
  335.                         $data['view_raw_set'] = false;
  336.                 }
  337.                 return $data;
  338.         }
  339.        
  340.         function view_options()
  341.         {
  342.                
  343.                 if (!$this->input->post('submit'))
  344.                 {
  345.                         $data = $this->_view_options_prep();
  346.                         $this->load->view('view/view_options', $data);
  347.                 }
  348.                 else
  349.                 {
  350.                         $this->load->library('form_validation');
  351.                         $rules = array(
  352.                                 array(
  353.                                         'field' => 'full_width',
  354.                                         'label' => 'full_width',
  355.                                         'rules' => 'max_length[1]',
  356.                                 ) ,
  357.                                 array(
  358.                                         'field' => 'view_raw',
  359.                                         'label' => 'view_raw',
  360.                                         'rules' => 'max_length[1]',
  361.                                 ) ,
  362.                         );
  363.                         $this->form_validation->set_rules($rules);
  364.                        
  365.                         if ($this->form_validation->run() == false)
  366.                         {
  367.                                 exit('Ugh, stupid skiddie.');
  368.                         }
  369.                         else
  370.                         {
  371.                                 $user_data = array(
  372.                                         'full_width' => $this->input->post('full_width') ,
  373.                                         'view_raw' => $this->input->post('view_raw') ,
  374.                                         'remember_view' => true
  375.                                 );
  376.                                 $this->db_session->set_userdata($user_data);
  377.                                 $this->db_session->set_flashdata('settings_changed', 'true');
  378.                                 redirect();
  379.                         }
  380.                 }
  381.         }
  382.        
  383.         function cron()
  384.         {
  385.                 $this->load->model('pastes');
  386.                 $key = $this->uri->segment(2);
  387.                
  388.                 if ($key != $this->config->item('cron_key'))
  389.                 {
  390.                         show_404();
  391.                 }
  392.                 else
  393.                 {
  394.                         $this->pastes->cron();
  395.                         return 0;
  396.                 }
  397.         }
  398.        
  399.         function about()
  400.         {
  401.                 $this->load->view('about');
  402.         }
  403.        
  404.         function _valid_lang($lang)
  405.         {
  406.                 $this->load->model('languages');
  407.                 $this->form_validation->set_message('_valid_lang', 'Please select your language');
  408.                 return $this->languages->valid_language($lang);
  409.         }
  410. }
  411.  

Replies to main.php rss

Title Name Language When
Re: main.php Serkan Kuyu php 6 Years ago.
Re: main.profile anon text 8 Years ago.
Re: main.php Whipped Bird php 12 Years ago.
Re: main.php Skaja php 12 Years ago.
iphone.php Claude php 13 Years ago.