male zmiany w konfiguracji, bazie danych, pare nowych funkcji w helpers, refaktoryzac...
[watermeloncms.git] / cms / wtrmln / modules / controllers / pages.php
blob4fa218528ad5e441820873954bc7dc3bf819c256
1 <?php
2 /********************************************************************
4 Watermelon CMS
6 Copyright 2008 Radosław Pietruszewski
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 ********************************************************************/
23 class Pages extends Controller
25 function Pages()
27 parent::Controller();
30 function Index()
32 // wyciągamy człony ścieżki (nazwa page'a)
34 $page = URL::$segments;
36 // łączymy w łańcuch
38 $page = implode('/', $page);
40 // sprawdzamy czy istnieje
42 $Pages = $this->load->model('Pages');
44 $data = $Pages->getData($page);
46 if($data->num_rows() > 0)
48 $data = $data->to_obj();
49 setH1($data->title);
51 $content = $data->content;
53 // w razie gdyby nie można było używać <? i <?=
55 if(@ini_get('short_open_tag') === FALSE)
57 $content = str_replace('<?=', '<?php echo ', $content);
58 $content = str_replace('<?', '<?php', $content);
61 // wykonujemy :)
63 eval('?>' . $content);
66 else
68 $this->e404();
72 function e404()
74 setH1('Błąd 404');
75 echo 'Błąd czterysta cztery - przykro mnie bardzo :P';