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

Untitled - Stikked
From songhj, 12 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.  * - rss()
  10.  * - embed()
  11.  * - download()
  12.  * - lists()
  13.  * - trends()
  14.  * - view()
  15.  * - cron()
  16.  * - about()
  17.  * - captcha()
  18.  * - _valid_lang()
  19.  * - _valid_captcha()
  20.  * - _valid_ip()
  21.  * - _blockwords_check()
  22.  * - _autofill_check()
  23.  * - _valid_authentication()
  24.  * - get_cm_js()
  25.  * - error_404()
  26.  * Classes list:
  27.  * - Main extends CI_Controller
  28.  */
  29.  
  30. class Main extends CI_Controller
  31. {
  32.        
  33.         function __construct()
  34.         {
  35.                 parent::__construct();
  36.                 $this->load->model('languages');
  37.                
  38.                 if ($this->config->item('require_auth'))
  39.                 {
  40.                         $this->load->library('auth_ldap');
  41.                 }
  42.                
  43.                 if (!$this->db->table_exists('ci_sessions'))
  44.                 {
  45.                         $this->load->dbforge();
  46.                         $fields = array(
  47.                                 'session_id' => array(
  48.                                         'type' => 'VARCHAR',
  49.                                         'constraint' => 40,
  50.                                         'default' => 0,
  51.                                 ) ,
  52.                                 'ip_address' => array(
  53.                                         'type' => 'VARCHAR',
  54.                                         'constraint' => 45,
  55.                                         'default' => 0,
  56.                                 ) ,
  57.                                 'user_agent' => array(
  58.                                         'type' => 'VARCHAR',
  59.                                         'constraint' => 50,
  60.                                 ) ,
  61.                                 'last_activity' => array(
  62.                                         'type' => 'INT',
  63.                                         'constraint' => 10,
  64.                                         'unsigned' => TRUE,
  65.                                         'default' => 0,
  66.                                 ) ,
  67.                                 'session_data' => array(
  68.                                         'type' => 'TEXT',
  69.                                         'null' => TRUE,
  70.                                 ) ,
  71.                         );
  72.                         $this->dbforge->add_field($fields);
  73.                         $this->dbforge->add_key('session_id', true);
  74.                         $this->dbforge->create_table('ci_sessions', true);
  75.                 }
  76.                
  77.                 if (!$this->db->table_exists('pastes'))
  78.                 {
  79.                         $this->load->dbforge();
  80.                         $fields = array(
  81.                                 'id' => array(
  82.                                         'type' => 'INT',
  83.                                         'constraint' => 10,
  84.                                         'auto_increment' => TRUE,
  85.                                 ) ,
  86.                                 'pid' => array(
  87.                                         'type' => 'VARCHAR',
  88.                                         'constraint' => 8,
  89.                                 ) ,
  90.                                 'title' => array(
  91.                                         'type' => 'VARCHAR',
  92.                                         'constraint' => 32,
  93.                                 ) ,
  94.                                 'name' => array(
  95.                                         'type' => 'VARCHAR',
  96.                                         'constraint' => 32,
  97.                                 ) ,
  98.                                 'lang' => array(
  99.                                         'type' => 'VARCHAR',
  100.                                         'constraint' => 32,
  101.                                 ) ,
  102.                                 'private' => array(
  103.                                         'type' => 'TINYINT',
  104.                                         'constraint' => 1,
  105.                                 ) ,
  106.                                 'raw' => array(
  107.                                         'type' => 'LONGTEXT',
  108.                                 ) ,
  109.                                 'created' => array(
  110.                                         'type' => 'INT',
  111.                                         'constraint' => 10,
  112.                                 ) ,
  113.                                 'expire' => array(
  114.                                         'type' => 'INT',
  115.                                         'constraint' => 10,
  116.                                         'default' => 0,
  117.                                 ) ,
  118.                                 'toexpire' => array(
  119.                                         'type' => 'TINYINT',
  120.                                         'constraint' => 1,
  121.                                         'unsigned' => TRUE,
  122.                                         'default' => 0,
  123.                                 ) ,
  124.                                 'snipurl' => array(
  125.                                         'type' => 'VARCHAR',
  126.                                         'constraint' => 64,
  127.                                         'default' => 0,
  128.                                 ) ,
  129.                                 'replyto' => array(
  130.                                         'type' => 'VARCHAR',
  131.                                         'constraint' => 8,
  132.                                 ) ,
  133.                                 'ip_address' => array(
  134.                                         'type' => 'VARCHAR',
  135.                                         'constraint' => 16,
  136.                                         'null' => TRUE,
  137.                                 ) ,
  138.                                 'hits' => array(
  139.                                         'type' => 'INT',
  140.                                         'constraint' => 10,
  141.                                         'default' => 0,
  142.                                 ) ,
  143.                                 'hits_updated' => array(
  144.                                         'type' => 'INT',
  145.                                         'constraint' => 10,
  146.                                         'default' => 0,
  147.                                 ) ,
  148.                         );
  149.                         $this->dbforge->add_field($fields);
  150.                         $this->dbforge->add_key('id', true);
  151.                         $this->dbforge->add_key('pid');
  152.                         $this->dbforge->add_key('private');
  153.                         $this->dbforge->add_key('replyto');
  154.                         $this->dbforge->add_key('created');
  155.                         $this->dbforge->add_key('ip_address');
  156.                         $this->dbforge->add_key('hits');
  157.                         $this->dbforge->add_key('hits_updated');
  158.                         $this->dbforge->create_table('pastes', true);
  159.                 }
  160.                
  161.                 if (!$this->db->table_exists('blocked_ips'))
  162.                 {
  163.                         $this->load->dbforge();
  164.                         $fields = array(
  165.                                 'ip_address' => array(
  166.                                         'type' => 'VARCHAR',
  167.                                         'constraint' => 16,
  168.                                         'default' => 0,
  169.                                 ) ,
  170.                                 'blocked_at' => array(
  171.                                         'type' => 'INT',
  172.                                         'constraint' => 10,
  173.                                 ) ,
  174.                                 'spam_attempts' => array(
  175.                                         'type' => 'INT',
  176.                                         'constraint' => 6,
  177.                                         'default' => 0,
  178.                                 ) ,
  179.                         );
  180.                         $this->dbforge->add_field($fields);
  181.                         $this->dbforge->add_key('ip_address', true);
  182.                         $this->dbforge->create_table('blocked_ips', true);
  183.                 }
  184.                
  185.                 if (!$this->db->table_exists('trending'))
  186.                 {
  187.                         $this->load->dbforge();
  188.                         $fields = array(
  189.                                 'paste_id' => array(
  190.                                         'type' => 'VARCHAR',
  191.                                         'constraint' => 8,
  192.                                 ) ,
  193.                                 'ip_address' => array(
  194.                                         'type' => 'VARCHAR',
  195.                                         'constraint' => 16,
  196.                                         'default' => 0,
  197.                                 ) ,
  198.                                 'created' => array(
  199.                                         'type' => 'INT',
  200.                                         'constraint' => 10,
  201.                                 ) ,
  202.                         );
  203.                         $this->dbforge->add_field($fields);
  204.                         $this->dbforge->add_key('paste_id', true);
  205.                         $this->dbforge->add_key('ip_address', true);
  206.                         $this->dbforge->add_key('created');
  207.                         $this->dbforge->create_table('trending', true);
  208.                 }
  209.                
  210.                 if (!$this->db->field_exists('ip_address', 'pastes'))
  211.                 {
  212.                         $this->load->dbforge();
  213.                         $fields = array(
  214.                                 'ip_address' => array(
  215.                                         'type' => 'VARCHAR',
  216.                                         'constraint' => 16,
  217.                                         'null' => TRUE,
  218.                                 ) ,
  219.                         );
  220.                         $this->dbforge->add_column('pastes', $fields);
  221.                 }
  222.                
  223.                 if (!$this->db->field_exists('hits', 'pastes'))
  224.                 {
  225.                         $this->load->dbforge();
  226.                         $fields = array(
  227.                                 'hits' => array(
  228.                                         'type' => 'INT',
  229.                                         'constraint' => 10,
  230.                                         'default' => 0,
  231.                                 ) ,
  232.                                 'hits_updated' => array(
  233.                                         'type' => 'INT',
  234.                                         'constraint' => 10,
  235.                                         'default' => 0,
  236.                                 ) ,
  237.                         );
  238.                         $this->dbforge->add_key('hits');
  239.                         $this->dbforge->add_key('hits_updated');
  240.                         $this->dbforge->add_column('pastes', $fields);
  241.                 }
  242.         }
  243.        
  244.         function _form_prep($lang = false, $title = '', $paste = '', $reply = false)
  245.         {
  246.                 $this->load->model('languages');
  247.                 $this->load->helper('form');
  248.                 $data['languages'] = $this->languages->get_languages();
  249.  
  250.                 //codemirror languages
  251.                 $this->load->config('codemirror_languages');
  252.                 $codemirror_languages = $this->config->item('codemirror_languages');
  253.                 $data['codemirror_languages'] = $codemirror_languages;
  254.  
  255.                 //codemirror modes
  256.                 $cmm = array();
  257.                 foreach ($codemirror_languages as $geshi_name => $l)
  258.                 {
  259.                        
  260.                         if (gettype($l) == 'array')
  261.                         {
  262.                                 $cmm[$geshi_name] = $l['mode'];
  263.                         }
  264.                 }
  265.                 $data['codemirror_modes'] = $cmm;
  266.                
  267.                 if (!$this->input->post('submit'))
  268.                 {
  269.                        
  270.                         if ($this->db_session->flashdata('settings_changed'))
  271.                         {
  272.                                 $data['status_message'] = 'Settings successfully changed';
  273.                         }
  274.                         $data['name_set'] = $this->db_session->userdata('name');
  275.                         $data['expire_set'] = $this->db_session->userdata('expire');
  276.                         $data['private_set'] = $this->db_session->userdata('private');
  277.                         $data['snipurl_set'] = $this->db_session->userdata('snipurl');
  278.                         $data['paste_set'] = $paste;
  279.                         $data['title_set'] = $title;
  280.                         $data['reply'] = $reply;
  281.                        
  282.                         if (!$lang)
  283.                         {
  284.                                 $lang = $this->config->item('default_language');
  285.                         }
  286.                         $data['lang_set'] = $lang;
  287.                 }
  288.                 else
  289.                 {
  290.                         $data['name_set'] = $this->input->post('name');
  291.                         $data['expire_set'] = $this->input->post('expire');
  292.                         $data['private_set'] = $this->input->post('private');
  293.                         $data['snipurl_set'] = $this->input->post('snipurl');
  294.                         $data['paste_set'] = $this->input->post('code');
  295.                         $data['title_set'] = $this->input->post('title');
  296.                         $data['reply'] = $this->input->post('reply');
  297.                         $data['lang_set'] = $this->input->post('lang');
  298.                 }
  299.                 return $data;
  300.         }
  301.        
  302.         function index()
  303.         {
  304.                 $this->_valid_authentication();
  305.                 $this->load->helper('json');
  306.                
  307.                 if (!$this->input->post('submit'))
  308.                 {
  309.                         $data = $this->_form_prep();
  310.                         $this->load->view('home', $data);
  311.                 }
  312.                 else
  313.                 {
  314.                         $this->load->model('pastes');
  315.                         $this->load->library('form_validation');
  316.  
  317.                         //rules
  318.                         $rules = array(
  319.                                 array(
  320.                                         'field' => 'code',
  321.                                         'label' => 'Main Paste',
  322.                                         'rules' => 'required',
  323.                                 ) ,
  324.                                 array(
  325.                                         'field' => 'lang',
  326.                                         'label' => 'Language',
  327.                                         'rules' => 'min_length[1]|required|callback__valid_lang',
  328.                                 ) ,
  329.                                 array(
  330.                                         'field' => 'captcha',
  331.                                         'label' => 'Captcha',
  332.                                         'rules' => 'callback__valid_captcha',
  333.                                 ) ,
  334.                                 array(
  335.                                         'field' => 'valid_ip',
  336.                                         'label' => 'Valid IP',
  337.                                         'rules' => 'callback__valid_ip',
  338.                                 ) ,
  339.                                 array(
  340.                                         'field' => 'blockwords_check',
  341.                                         'label' => 'No blocked words',
  342.                                         'rules' => 'callback__blockwords_check',
  343.                                 ) ,
  344.                                 array(
  345.                                         'field' => 'email',
  346.                                         'label' => 'Field must remain empty',
  347.                                         'rules' => 'callback__autofill_check',
  348.                                 ) ,
  349.                         );
  350.  
  351.                         //form validation
  352.                         $this->form_validation->set_rules($rules);
  353.                         $this->form_validation->set_message('min_length', 'The %s field can not be empty');
  354.                         $this->form_validation->set_error_delimiters('<div class="message error"><div class="container">', '</div></div>');
  355.                        
  356.                         if ($this->form_validation->run() == FALSE)
  357.                         {
  358.                                 $data = $this->_form_prep();
  359.                                 $this->load->view('home', $data);
  360.                         }
  361.                         else
  362.                         {
  363.                                
  364.                                 if ($this->config->item('private_only'))
  365.                                 {
  366.                                         $_POST['private'] = 1;
  367.                                 }
  368.                                
  369.                                 if ($this->input->post('reply') == false)
  370.                                 {
  371.                                         $user_data = array(
  372.                                                 'name' => $this->input->post('name') ,
  373.                                                 'lang' => $this->input->post('lang') ,
  374.                                                 'expire' => $this->input->post('expire') ,
  375.                                                 'snipurl' => $this->input->post('snipurl') ,
  376.                                                 'private' => $this->input->post('private') ,
  377.                                         );
  378.                                         $this->db_session->set_userdata($user_data);
  379.                                 }
  380.                                 redirect($this->pastes->createPaste());
  381.                         }
  382.                 }
  383.         }
  384.        
  385.         function raw()
  386.         {
  387.             error_log('raw', 0);
  388.                 $this->_valid_authentication();
  389.                 $this->load->model('pastes');
  390.                 $check = $this->pastes->checkPaste(3);
  391.                
  392.                 if ($check)
  393.                 {
  394.                         $data = $this->pastes->getPaste(3);
  395.                         $this->load->view('view/raw', $data);
  396.                 }
  397.                 else
  398.                 {
  399.                         show_404();
  400.                 }
  401.         }
  402.        
  403.         function rss()
  404.         {
  405.             error_log('rss()', 0);
  406.                 $this->_valid_authentication();
  407.                 $this->load->model('pastes');
  408.                 $check = $this->pastes->checkPaste(3);
  409.                
  410.                 if ($check)
  411.                 {
  412.                         $this->load->helper('text');
  413.                         $paste = $this->pastes->getPaste(3);
  414.                         $data = $this->pastes->getReplies(3);
  415.                         $data['page_title'] = $paste['title'] . ' - ' . $this->config->item('site_name');
  416.                         $data['feed_url'] = site_url('view/rss/' . $this->uri->segment(3));
  417.                         $this->load->view('view/rss', $data);
  418.                 }
  419.                 else
  420.                 {
  421.                         show_404();
  422.                 }
  423.         }
  424.        
  425.         function embed()
  426.         {
  427.                 $this->_valid_authentication();
  428.                 $this->load->model('pastes');
  429.                 $check = $this->pastes->checkPaste(3);
  430.                
  431.                 if ($check)
  432.                 {
  433.                         $data = $this->pastes->getPaste(3);
  434.                         $this->load->view('view/embed', $data);
  435.                 }
  436.                 else
  437.                 {
  438.                         show_404();
  439.                 }
  440.         }
  441.        
  442.         function download()
  443.         {
  444.             error_log('download()', 0);
  445.                 $this->_valid_authentication();
  446.                 $this->load->model('pastes');
  447.                 $check = $this->pastes->checkPaste(3);
  448.                
  449.                 if ($check)
  450.                 {
  451.                         $data = $this->pastes->getPaste(3);
  452.                         $this->load->view('view/download', $data);
  453.                 }
  454.                 else
  455.                 {
  456.                         show_404();
  457.                 }
  458.         }
  459.        
  460.         function lists()
  461.         {
  462.             error_log($this->uri->segment(2), 0);
  463.                 $this->_valid_authentication();
  464.                 error_log('aaa', 0);
  465.                 if ($this->config->item('private_only'))
  466.                 {
  467.                     error_log('show_404()', 0);
  468.                         show_404();
  469.                 }
  470.                 else
  471.                 {
  472.                     error_log('xxx()', 0);
  473.                         $this->load->model('pastes');
  474.                         error_log('yyy()', 0);
  475.                         $data = $this->pastes->getLists();
  476.                         error_log('111()', 0);
  477.                         if ($this->uri->segment(2) == 'rss')
  478.                         {
  479.                             error_log('2222', 0);
  480.                                 $this->load->helper('text');
  481.                                 $data['page_title'] = $this->config->item('site_name');
  482.                                 $data['feed_url'] = site_url('lists/rss');
  483.                                 $data['replies'] = $data['pastes'];
  484.                                 unset($data['pastes']);
  485.                                 $this->load->view('view/rss', $data);
  486.                         }
  487.                         else
  488.                         {
  489.                             error_log('list()', 0);
  490.                                 $this->load->view('list', $data);
  491.                         }
  492.                 }
  493.                 error_log('bbb', 0);
  494.         }
  495.        
  496.         function trends()
  497.         {
  498.                 $this->_valid_authentication();
  499.                
  500.                 if ($this->config->item('private_only'))
  501.                 {
  502.                         show_404();
  503.                 }
  504.                 else
  505.                 {
  506.                         $this->load->model('pastes');
  507.                         $data = $this->pastes->getTrends();
  508.                         $this->load->view('trends', $data);
  509.                 }
  510.         }
  511.        
  512.         function view()
  513.         {
  514.                 $this->_valid_authentication();
  515.                 $this->load->helper('json');
  516.                 $this->load->model('pastes');
  517.                 $check = $this->pastes->checkPaste(2);
  518.                
  519.                 if ($check)
  520.                 {
  521.                        
  522.                         if ($this->db_session->userdata('view_raw'))
  523.                         {
  524.                                 redirect('view/raw/' . $this->uri->segment(2));
  525.                         }
  526.                         $data = $this->pastes->getPaste(2, true);
  527.                         $data['reply_form'] = $this->_form_prep($data['lang_code'], 'Re: ' . $data['title'], $data['raw'], $data['pid']);
  528.                         $this->load->view('view/view', $data);
  529.                 }
  530.                 else
  531.                 {
  532.                         show_404();
  533.                 }
  534.         }
  535.        
  536.         function cron()
  537.         {
  538.                 $this->load->model('pastes');
  539.                 $key = $this->uri->segment(2);
  540.                
  541.                 if ($key != $this->config->item('cron_key'))
  542.                 {
  543.                         show_404();
  544.                 }
  545.                 else
  546.                 {
  547.                         $this->pastes->cron();
  548.                         return 0;
  549.                 }
  550.         }
  551.        
  552.         function about()
  553.         {
  554.                 $this->load->view('about');
  555.         }
  556.        
  557.         function captcha()
  558.         {
  559.                 $this->load->helper('captcha');
  560.  
  561.                 //get "word"
  562.                 $pool = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ@';
  563.                 $str = '';
  564.                 for ($i = 0;$i < 4;$i++)
  565.                 {
  566.                         $str.= substr($pool, mt_rand(0, strlen($pool) - 1) , 1);
  567.                 }
  568.                 $word = $str;
  569.  
  570.                 //save
  571.                 $this->db_session->set_userdata(array(
  572.                         'captcha' => $word
  573.                 ));
  574.  
  575.                 //view
  576.                 $this->load->view('view/captcha', array(
  577.                         'word' => $word
  578.                 ));
  579.         }
  580.        
  581.         function _valid_lang($lang)
  582.         {
  583.                 $this->load->model('languages');
  584.                 $this->form_validation->set_message('_valid_lang', 'Please select your language');
  585.                 return $this->languages->valid_language($lang);
  586.         }
  587.        
  588.         function _valid_captcha($text)
  589.         {
  590.                
  591.                 if ($this->config->item('enable_captcha'))
  592.                 {
  593.                         $this->form_validation->set_message('_valid_captcha', 'The Captcha is incorrect.');
  594.                         return strtolower($text) == strtolower($this->db_session->userdata('captcha'));
  595.                 }
  596.                 else
  597.                 {
  598.                         return true;
  599.                 }
  600.         }
  601.        
  602.         function _valid_ip()
  603.         {
  604.  
  605.                 //get ip
  606.                 $ip_address = $this->input->ip_address();
  607.                 $ip = explode('.', $ip_address);
  608.                 $ip_firstpart = $ip[0] . '.' . $ip[1] . '.';
  609.  
  610.                 //setup message
  611.                 $this->form_validation->set_message('_valid_ip', 'You are not allowed to paste.');
  612.  
  613.                 //lookup
  614.                 $this->db->select('ip_address, spam_attempts');
  615.                 $this->db->like('ip_address', $ip_firstpart, 'after');
  616.                 $query = $this->db->get('blocked_ips');
  617.  
  618.                 //check
  619.                
  620.                 if ($query->num_rows() > 0)
  621.                 {
  622.  
  623.                         //update spamcount
  624.                         $blocked_ips = $query->result_array();
  625.                         $spam_attempts = $blocked_ips[0]['spam_attempts'];
  626.                         $this->db->where('ip_address', $ip_address);
  627.                         $this->db->update('blocked_ips', array(
  628.                                 'spam_attempts' => $spam_attempts + 1,
  629.                         ));
  630.  
  631.                         //return for the validation
  632.                         return false;
  633.                 }
  634.                 else
  635.                 {
  636.                         return true;
  637.                 }
  638.         }
  639.        
  640.         function _blockwords_check()
  641.         {
  642.  
  643.                 //setup message
  644.                 $this->form_validation->set_message('_blockwords_check', 'Your paste contains blocked words.');
  645.  
  646.                 //check
  647.                 $blocked_words = $this->config->item('blocked_words');
  648.                 $post = $this->input->post();
  649.                 $raw = $post['code'];
  650.                 foreach (explode(',', $blocked_words) as $word)
  651.                 {
  652.                         $word = trim($word);
  653.                        
  654.                         if (stristr($raw, $word))
  655.                         {
  656.                                 return false;
  657.                         }
  658.                 }
  659.                 return true;
  660.         }
  661.        
  662.         function _autofill_check()
  663.         {
  664.  
  665.                 //setup message
  666.                 $this->form_validation->set_message('_autofill_check', 'Go away, robot!');
  667.  
  668.                 //check
  669.                 return !$this->input->post('email');
  670.         }
  671.        
  672.         function _valid_authentication()
  673.         {
  674.                
  675.                 if ($this->config->item('require_auth'))
  676.                 {
  677.                        
  678.                         if (!$this->auth_ldap->is_authenticated())
  679.                         {
  680.                                 $this->db_session->set_flashdata('tried_to', "/" . $this->uri->uri_string());
  681.                                 redirect('/auth');
  682.                         }
  683.                 }
  684.         }
  685.        
  686.         function get_cm_js()
  687.         {
  688.                 $lang = $this->uri->segment(3);
  689.                 $this->load->config('codemirror_languages');
  690.                 $cml = $this->config->item('codemirror_languages');
  691.                
  692.                 if (isset($cml[$lang]) && gettype($cml[$lang]) == 'array')
  693.                 {
  694.                         header('Content-Type: application/x-javascript; charset=utf-8');
  695.                         foreach ($cml[$lang]['js'] as $js)
  696.                         {
  697.                                 echo file_get_contents('./static/js/' . $js[0]);
  698.                         }
  699.                 }
  700.                 exit;
  701.         }
  702.        
  703.         function error_404()
  704.         {
  705.                 show_404();
  706.         }
  707. }
  708.