forked from aikiframework/aikiframework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
style.php
executable file
·75 lines (64 loc) · 1.97 KB
/
style.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* Aiki Framework (PHP)
*
* LICENSE
*
* This source file is subject to the AGPL-3.0 license that is bundled
* with this package in the file LICENSE.
*
* @author Aikilab http://www.aikilab.com
* @copyright (c) 2008-2011 Aiki Lab Pte Ltd
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
* @link http://www.aikiframework.org
* @category Aiki
* @package Aiki
* @filesource
*/
/**
* File for outputting CSS for a rendered page.
*/
header('Content-type: text/css');
/**
* @see bootstrap.php
*/
require_once("bootstrap.php");
config_error_reporting(0);
// if a previous valid css file exists, cache_fileoutputs it and dies.
$cached_file = $aiki->Output->cache_file("css");
/**
* @global string $widgets
*/
$widgets_list = isset($_GET['widgets']) ? addslashes($_GET['widgets']) : '';
if ( $widgets_list != '' ) {
$where = "id='" . str_replace('_', "' or id = '", $widgets_list) . "'";
$sql = "SELECT id, css, widget_name" .
" FROM aiki_widgets".
" WHERE " . $where .
" AND is_active = 1".
" ORDER BY id";
$get_widgets = $db->get_results($sql);
if ($get_widgets) {
$debugOn = is_debug_on();
$style="";
foreach ($get_widgets as $widget) {
if ( $widget->css != "" ) {
$style .= ($debugOn ? "\n/*CSS for the widget {$widget->widget_name} (id {$widget->id}) */\n" : "") .
stripcslashes($aiki->languages->L10n($widget->css));
}
}
if ($style) {
// predefined vars.
$vars = array (
"view" => $aiki->site->view(),
"language" => $aiki->site->language(),
"site" => $aiki->site->get_site());
$style = $aiki->CssParser->parse($style, $vars );
}
echo $style;
if ($cached_file) {
//write the cache file
error_log ($style, 3, $cached_file);
}
}
}