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: 575
Function: getPaste

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

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/system/core/Exceptions.php:271)

Filename: view/rss.php

Line Number: 2

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/themes/geocities/views/view/rss.php
Line: 2
Function: header

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/core/MY_Loader.php
Line: 173
Function: include

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/core/MY_Loader.php
Line: 43
Function: _ci_load

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

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

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