public
Description: Git mirror of the CMS Made Simple 2.0 rewrite
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsmadesimple-2-0.git
Search Repo:
Change stylesheet table definitions in the installer
Refactored stylesheet.php, the header and stylesheet plugins and all their 
related calls
Added new cms_orm('class_name') convention to save typing

Signed-off-by: Ted Kulp <ted@cmsmadesimple.org>


git-svn-id: http://svn.cmsmadesimple.org/svn/cmsmadesimple/trunk@4327 
3d254a34-79dc-0310-9e5f-be208747d8a0
tedkulp (author)
Sat Feb 02 18:15:22 -0800 2008
commit  73ce5eebb0b1f9daa4164e5cfd8c367731f73ef1
tree    9e1fe7d80c5148bbaa257603c2dae2e6e722edf2
parent  9326b3f954cc0c985f072b88db890ce6e89fe191
...
78
79
80
81
 
82
83
84
...
78
79
80
 
81
82
83
84
0
@@ -78,7 +78,7 @@ if ($access)
0
       $types='';
0
     }
0
       
0
- $stylesheet_object->media_type = $types;
0
+ $stylesheet_object->media_type = $types;
0
 
0
     if ($stylesheet_object->save())
0
     {
...
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
...
241
242
243
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
245
246
247
248
249
 
250
251
252
...
90
91
92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
94
95
...
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
 
251
252
253
254
0
@@ -90,26 +90,6 @@ CmsInstallOperations::create_table($db, 'crossref', "
0
 CmsInstallOperations::create_index($db, 'crossref', 'child_type_and_id', 'child_type,child_id');
0
 CmsInstallOperations::create_index($db, 'crossref', 'parent_type_and_id', 'parent_type,parent_id');
0
 
0
-CmsInstallOperations::create_table($db, 'css', "
0
- id I KEY AUTO,
0
- css_name C(255),
0
- css_text XL,
0
- media_type C(255),
0
- create_date T,
0
- modified_date T
0
-");
0
-CmsInstallOperations::create_index($db, 'css', 'css_name', 'css_name');
0
-
0
-CmsInstallOperations::create_table($db, 'css_assoc', "
0
- assoc_to_id I,
0
- assoc_css_id I,
0
- assoc_type C(80),
0
- create_date T,
0
- modified_date T
0
-");
0
-CmsInstallOperations::create_index($db, 'css_assoc', 'assoc_to_id', 'assoc_to_id');
0
-CmsInstallOperations::create_index($db, 'css_assoc', 'assoc_css_id', 'assoc_css_id');
0
-
0
 CmsInstallOperations::create_table($db, 'event_handlers', "
0
   event_id I,
0
   tag_name c(255),
0
@@ -241,12 +221,34 @@ CmsInstallOperations::create_table($db, 'siteprefs', "
0
   modified_date T
0
 ");
0
 
0
+CmsInstallOperations::create_table($db, 'stylesheets', "
0
+ id I KEY AUTO,
0
+ name C(255),
0
+ value XL,
0
+ active I1 default 1,
0
+ media_type C(255),
0
+ create_date T,
0
+ modified_date T
0
+");
0
+CmsInstallOperations::create_index($db, 'stylesheets', 'name', 'name');
0
+
0
+CmsInstallOperations::create_table($db, 'stylesheet_template_assoc', "
0
+ stylesheet_id I,
0
+ template_id I,
0
+ order_num I,
0
+ create_date T,
0
+ modified_date T
0
+");
0
+CmsInstallOperations::create_index($db, 'stylesheet_template_assoc', 'stylesheet_id', 'stylesheet_id');
0
+CmsInstallOperations::create_index($db, 'stylesheet_template_assoc', 'template_id', 'template_id');
0
+CmsInstallOperations::create_index($db, 'stylesheet_template_assoc', 'stylesheet_id_template_id', 'stylesheet_id,template_id');
0
+
0
 CmsInstallOperations::create_table($db, 'templates', "
0
   id I KEY AUTO,
0
   template_name C(255),
0
   template_content XL,
0
   encoding C(25),
0
- active I1,
0
+ active I1 default 1,
0
   default_template I1,
0
   create_date T,
0
   modified_date T
...
62
63
64
 
 
 
 
 
65
66
67
 
 
68
69
70
...
62
63
64
65
66
67
68
69
70
71
 
72
73
74
75
76
0
@@ -62,9 +62,15 @@ class CmsStylesheet extends CmsObjectRelationalMapping
0
     }
0
   }
0
   
0
+ public function get_media_types_as_array()
0
+ {
0
+ return explode(', ', $this->media_type);
0
+ }
0
+
0
   public function setup()
0
   {
0
- $this->create_has_and_belongs_to_many_association('templates', 'template', 'cms_stylesheet_template_assoc', 'template_id', 'stylesheet_id', array('order' => 'cms_stylesheet_template_assoc.order_num ASC'));
0
+ $this->create_has_and_belongs_to_many_association('templates', 'template', 'stylesheet_template_assoc', 'template_id', 'stylesheet_id', array('order' => 'order_num ASC'));
0
+ $this->create_has_and_belongs_to_many_association('active_templates', 'template', 'stylesheet_template_assoc', 'template_id', 'stylesheet_id', array('order' => 'order_num ASC', 'conditions' => 'templates.active = 1'));
0
   }
0
   
0
   //Callback handlers
...
37
38
39
40
41
42
43
44
45
 
 
46
47
48
...
54
55
56
 
 
 
 
 
57
58
59
...
71
72
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
75
76
...
37
38
39
 
 
 
 
 
 
40
41
42
43
44
...
50
51
52
53
54
55
56
57
58
59
60
...
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
0
@@ -37,12 +37,8 @@ class CmsTemplate extends CmsObjectRelationalMapping
0
   
0
   public function setup()
0
   {
0
- $this->create_has_and_belongs_to_many_association('stylesheets', 'stylesheet', 'cms_stylesheet_template_assoc', 'stylesheet_id', 'template_id', array('order' => 'cms_stylesheet_template_assoc.order_num ASC'));
0
- }
0
-
0
- function UsageCount()
0
- {
0
- return $this->usage_count();
0
+ $this->create_has_and_belongs_to_many_association('stylesheets', 'stylesheet', 'stylesheet_template_assoc', 'stylesheet_id', 'template_id', array('order' => 'order_num ASC'));
0
+ $this->create_has_and_belongs_to_many_association('active_stylesheets', 'stylesheet', 'stylesheet_template_assoc', 'stylesheet_id', 'template_id', array('order' => 'order_num ASC', 'conditions' => 'stylesheets.active = 1'));
0
   }
0
   
0
   function usage_count()
0
@@ -54,6 +50,11 @@ class CmsTemplate extends CmsObjectRelationalMapping
0
       return 0;
0
   }
0
   
0
+ function UsageCount()
0
+ {
0
+ return $this->usage_count();
0
+ }
0
+
0
   function validate()
0
   {
0
     $this->validate_not_blank('name', lang('nofieldgiven',array(lang('title'))));
0
@@ -71,6 +72,22 @@ class CmsTemplate extends CmsObjectRelationalMapping
0
     }
0
   }
0
   
0
+ public function get_stylesheet_media_types($show_inactive = false)
0
+ {
0
+ $result = array();
0
+
0
+ foreach ($this->active_stylesheets as $stylesheet)
0
+ {
0
+ foreach ($stylesheet->get_media_types_as_array() as $media_type)
0
+ {
0
+ if (!in_array($media_type, $result))
0
+ $result[] = $media_type;
0
+ }
0
+ }
0
+
0
+ return $result;
0
+ }
0
+
0
   //Callback handlers
0
   function before_save()
0
   {
...
144
145
146
147
 
148
149
 
 
 
 
150
151
152
...
144
145
146
 
147
148
 
149
150
151
152
153
154
155
0
@@ -144,9 +144,12 @@ function cms_db()
0
   return CmsDatabase::get_instance();
0
 }
0
 
0
-function cms_orm()
0
+function cms_orm($class = '')
0
 {
0
- return CmsObjectRelationalManager::get_instance();
0
+ if ($class == '')
0
+ return CmsObjectRelationalManager::get_instance();
0
+ else
0
+ return CmsObjectRelationalManager::get_instance()->$class;
0
 }
0
 
0
 /**
...
19
20
21
22
23
 
24
25
26
...
31
32
33
34
 
35
36
37
38
39
 
 
40
41
42
 
43
44
 
 
 
 
 
 
 
 
 
 
 
45
46
47
48
49
50
51
52
53
54
...
85
86
87
88
 
89
90
91
...
19
20
21
 
22
23
24
25
26
...
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
...
89
90
91
 
92
93
94
95
0
@@ -19,8 +19,8 @@
0
 function smarty_cms_function_header($params, &$smarty)
0
 {
0
   global $gCms;
0
- $config =& $gCms->GetConfig();
0
   $pageinfo =& $gCms->variables['pageinfo'];
0
+ $root_url = CmsConfig::get('root_url');
0
   
0
   $result = '';
0
   
0
@@ -31,24 +31,28 @@ function smarty_cms_function_header($params, &$smarty)
0
     {
0
       $result .= 'media="' . $params['media'] . '" ';
0
     }
0
- $result .= 'href="'.$config['root_url'].'/stylesheet.php?name='.$params['name'];
0
+ $result .= 'href="'.$root_url.'/stylesheet.php?name='.$params['name'];
0
     $result .= "\" />\n";
0
   }
0
   else
0
   {
0
- foreach (get_stylesheet_media_types($pageinfo->template_id) as $media)
0
+ $template = cms_orm('cms_template')->find_by_id($pageinfo->template_id);
0
+ if ($template)
0
     {
0
- $result .= '<link rel="result" type="text/css" ';
0
- if ($media != '')
0
+ foreach ($template->get_stylesheet_media_types() as $media)
0
       {
0
- $result .= 'media="'.$media.'" ';
0
+ $result .= '<link rel="result" type="text/css" ';
0
+ if ($media != '')
0
+ {
0
+ $result .= 'media="'.$media.'" ';
0
+ }
0
+ $result .= "href=\"{$root_url}/stylesheet.php?templateid={$pageinfo->template_id}";
0
+ if ($media != '')
0
+ {
0
+ $result .= '&amp;mediatype='.urlencode($media);
0
+ }
0
+ $result .= "\" />\n";
0
       }
0
- $result .= 'href="'.$config['root_url'].'/stylesheet.php?templateid='.$pageinfo->template_id;
0
- if ($media != '')
0
- {
0
- $result .= '&amp;mediatype='.urlencode($media);
0
- }
0
- $result .= "\" />\n";
0
     }
0
   }
0
   
0
@@ -85,7 +89,7 @@ function smarty_cms_function_header($params, &$smarty)
0
 
0
   if ($showbase)
0
   {
0
- $result .= "\n<base href=\"".$config['root_url']."/\" />\n";
0
+ $result .= "\n<base href=\"".$root_url."/\" />\n";
0
   }
0
   
0
   if (array_key_exists('assign', $params))
...
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
...
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
0
@@ -19,51 +19,50 @@
0
 function smarty_cms_function_stylesheet($params, &$smarty)
0
 {
0
   global $gCms;
0
- $config = cms_config();
0
- $pageinfo = &$gCms->variables['pageinfo'];
0
-
0
- $stylesheet = '';
0
+ $pageinfo =& $gCms->variables['pageinfo'];
0
+ $root_url = CmsConfig::get('root_url');
0
+
0
+ $result = '';
0
   
0
   if (isset($params['name']) && $params['name'] != '')
0
   {
0
- $stylesheet .= '<link rel="stylesheet" type="text/css" ';
0
+ $result .= '<link rel="result" type="text/css" ';
0
     if (isset($params['media']) && $params['media'] != '')
0
     {
0
- $stylesheet .= 'media="' . $params['media'] . '" ';
0
+ $result .= 'media="' . $params['media'] . '" ';
0
     }
0
- $stylesheet .= 'href="'.$config['root_url'].'/stylesheet.php?name='.$params['name'];
0
- $stylesheet .= "\" />\n";
0
+ $result .= 'href="'.$root_url.'/stylesheet.php?name='.$params['name'];
0
+ $result .= "\" />\n";
0
   }
0
   else
0
   {
0
- foreach (get_stylesheet_media_types($pageinfo->template_id) as $media)
0
+ $template = cms_orm('cms_template')->find_by_id($pageinfo->template_id);
0
+ if ($template)
0
     {
0
- $stylesheet .= '<link rel="stylesheet" type="text/css" ';
0
- if ($media != '')
0
- {
0
- $stylesheet .= 'media="'.$media.'" ';
0
- }
0
- $stylesheet .= 'href="'.$config['root_url'].'/stylesheet.php?templateid='.$pageinfo->template_id;
0
- if ($media != '')
0
+ foreach ($template->get_stylesheet_media_types() as $media)
0
       {
0
- $stylesheet .= '&amp;mediatype='.urlencode($media);
0
+ $result .= '<link rel="result" type="text/css" ';
0
+ if ($media != '')
0
+ {
0
+ $result .= 'media="'.$media.'" ';
0
+ }
0
+ $result .= "href=\"{$root_url}/stylesheet.php?templateid={$pageinfo->template_id}";
0
+ if ($media != '')
0
+ {
0
+ $result .= '&amp;mediatype='.urlencode($media);
0
+ }
0
+ $result .= "\" />\n";
0
       }
0
- $stylesheet .= "\" />\n";
0
     }
0
   }
0
-
0
- if (!(isset($config['use_smarty_php_tags']) && $config['use_smarty_php_tags'] == true))
0
- {
0
- $stylesheet = ereg_replace("\{\/?php\}", '', $stylesheet);
0
- }
0
   
0
   if (array_key_exists('assign', $params))
0
   {
0
- $smarty->assign($params['assign'], $stylesheet);
0
+ $smarty->assign($params['assign'], $result);
0
   }
0
   else
0
   {
0
- return $stylesheet;
0
+ return $result;
0
   }
0
 }
0
 
...
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
76
77
 
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
 
127
128
129
130
 
 
131
132
133
134
135
136
137
 
 
 
 
138
139
140
141
142
143
144
 
 
145
146
147
148
 
149
150
151
152
153
154
155
156
157
 
158
159
160
...
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
0
@@ -23,138 +23,49 @@ if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/MSIE/', $_SERVER['HTTP_USE
0
   @ini_set( 'zlib.output_compression','Off' );
0
 }
0
 
0
-$templateid = '';
0
-if (isset($_GET["templateid"])) $templateid = $_GET["templateid"];
0
+$dirname = dirname(__FILE__);
0
+require_once($dirname.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'cmsms.api.php');
0
 
0
-$mediatype = '';
0
-if (isset($_GET["mediatype"])) $mediatype = $_GET["mediatype"];
0
+$template_id = coalesce_key($_GET, 'templateid', '');
0
+$mediatype = coalesce_key($_GET, 'mediatype', '');
0
+$cssid = coalesce_key($_GET, 'cssid', '');
0
+$name = coalesce_key($_GET, 'name', '');
0
+$stripbackground = isset($_GET["stripbackground"]) ? true :false;
0
 
0
-$cssid = '';
0
-if (isset($_GET['cssid'])) $cssid = $_GET['cssid'];
0
-
0
-$name = '';
0
-if (isset($_GET['name'])) $name = $_GET['name'];
0
-
0
-$stripbackground = false;
0
-if (isset($_GET["stripbackground"])) $stripbackground = true;
0
-
0
-if ($templateid == '' && $name == '' && $cssid == '') return '';
0
-
0
-require_once('config.php');
0
+if ($template_id == '' && $name == '' && $cssid == '') return '';
0
 
0
 $css='';
0
 
0
-if (isset($config['old_stylesheet']) && $config['old_stylesheet'] == false)
0
+if ($name != '')
0
 {
0
- // connect to the database
0
- require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'misc.functions.php');
0
- require_once(cms_join_path(dirname(__FILE__),'lib','adodb.functions.php'));
0
- load_adodb();
0
- $db =& adodb_connect();
0
-
0
- // select the stylesheet(s)
0
- if ($name != '')
0
- $sql="SELECT css_text, css_name FROM ".$config['db_prefix']."css WHERE css_name = " . $db->qstr($name);
0
- else if( $cssid != '' )
0
- $sql="SELECT css_text, css_name FROM ".$config['db_prefix']."css WHERE css_id = ".$db->qstr($cssid);
0
- else
0
- $sql="SELECT c.css_text, c.css_id, c.css_name FROM ".$config['db_prefix']."css c,".$config['db_prefix']."css_assoc ac WHERE ac.assoc_type='template' AND ac.assoc_to_id = ".$db->qstr($templateid)." AND ac.assoc_css_id = c.css_id AND c.media_type = " . $db->qstr($mediatype) . " ORDER BY ac.create_date";
0
- $result = $db->Execute($sql);
0
-
0
- // add a comment at the start
0
- while ($result && $row = $result->FetchRow())
0
+ $stylesheet = cms_orm('cms_stylesheet')->find_by_name($name);
0
+ if ($stylesheet)
0
   {
0
- $db = mysql_connect($config['db_hostname'], $config['db_username'], $config['db_password']);
0
- mysql_select_db($config['db_name']);
0
- if ($name != '')
0
- $sql="SELECT css_text, css_name FROM ".$config['db_prefix']."css WHERE css_name = '" . mysql_real_escape_string($name, $db) . "'";
0
- else
0
- $sql="SELECT c.css_text, c.id, c.css_name FROM ".$config['db_prefix']."css c,".$config['db_prefix']."css_assoc ac WHERE ac.assoc_type='template' AND ac.assoc_to_id = $templateid AND ac.assoc_css_id = c.id AND c.media_type = '" . mysql_real_escape_string($mediatype, $db) . "' ORDER BY ac.create_date";
0
- $result=mysql_query($sql);
0
- while ($result && $row = mysql_fetch_assoc($result))
0
- {
0
- $css .= "/* Start of CMSMS style sheet '{$row['css_name']}' */\n{$row['css_text']}\n/* End of '{$row['css_name']}' */\n\n";
0
- }
0
+ $css .= "/* Start of CMSMS style sheet '{$stylesheet->name}' */\n{$stylesheet->value}\n/* End of '{$stylesheet->name}' */\n";
0
   }
0
- else if($config['dbms'] == 'sqlite') {
0
- $db = sqlite_open($config['db_hostname']);
0
- sqlite_exec($db,'PRAGMA short_column_names = 1;');
0
- if ($name != '')
0
- $sql="SELECT css_text, css_name FROM ".$config['db_prefix']."css WHERE css_name = '" . sqlite_escape_string($name) . "'";
0
- else
0
- $sql="SELECT c.css_text, c.id, c.css_name FROM ".$config['db_prefix']."css c,".$config['db_prefix']."css_assoc ac WHERE ac.assoc_type='template' AND ac.assoc_to_id = $templateid AND ac.assoc_css_id = c.id AND c.media_type = '" . sqlite_escape_string($mediatype) . "' ORDER BY ac.create_date";
0
- $result=sqlite_array_query($db,$sql,SQLITE_ASSOC);
0
- foreach($result as $row)
0
- {
0
- $css .= "/* Start of CMSMS style sheet '{$row['css_name']}' */\n{$row['css_text']}\n/* End of '{$row['css_name']}' */\n\n";
0
- }
0
- }
0
- else
0
- {
0
- $db=pg_connect((isset($config['db_hostname']) && $config['db_hostname'] ? "host=".$config['db_hostname'] : '')." dbname=".$config['db_name']." user=".$config['db_username']." password=".$config['db_password']);
0
- if ($name != '')
0
- $sql="SELECT css_text, css_name FROM ".$config['db_prefix']."css WHERE css_name = '" . pg_escape_string($name) . "'";
0
- else
0
- $sql="SELECT c.css_text, c.id, c.css_name FROM ".$config['db_prefix']."css c,".$config['db_prefix']."css_assoc ac WHERE ac.assoc_type='template' AND ac.assoc_to_id = $templateid AND ac.assoc_css_id = c.id AND c.media_type = '" . pg_escape_string($mediatype) . "' ORDER BY ac.create_date";
0
- $result=pg_query($db, $sql);
0
- while ($result && $row = pg_fetch_array($result, null, PGSQL_ASSOC))
0
- {
0
- $css .= "/* Start of CMSMS style sheet '{$row['css_name']}' */\n{$row['css_text']}\n/* End of '{$row['css_name']}' */\n\n";
0
- }
0
- }
0
-
0
- header("Content-Type: text/css; charset=" .$encoding);
0
 }
0
 else
0
 {
0
- require_once(dirname(__FILE__)."/include.php");
0
-
0
- if ($name != '')
0
- {
0
- //TODO: Make stylesheet handling OOP
0
- global $gCms;
0
- $db =& $gCms->GetDb();
0
- $cssquery = "SELECT css_text, css_name FROM ".cms_db_prefix()."css WHERE css_name = ?";
0
- $cssresult = &$db->Execute($cssquery, array($name));
0
-
0
- while ($cssresult && !$cssresult->EOF)
0
- {
0
- $css .= "/* Start of CMSMS style sheet '{$cssresult->fields['css_name']}' */\n{$cssresult->fields['css_text']}\n/* End of '{$cssresult->fields['css_name']}' */\n";
0
- $cssresult->MoveNext();
0
- }
0
- }
0
- else
0
+ if (isset($template_id) && is_numeric($template_id) && $template_id > -1)
0
   {
0
- $result = get_stylesheet($templateid, $mediatype);
0
- $css = $result['stylesheet'];
0
- if (!isset($result['nostylesheet']))
0
+ $template = cms_orm('cms_template')->find_by_id($template_id);
0
+ if ($template)
0
     {
0
- #$nostylesheet = true;
0
- #Perform the content stylesheet callback
0
- #if ($nostylesheet == false)
0
- #{
0
- reset($gCms->modules);
0
- while (list($key) = each($gCms->modules))
0
+ $stylesheets = $template->active_stylesheets;
0
+ if ($stylesheets)
0
+ {
0
+ foreach ($stylesheets as $stylesheet)
0
         {
0
- $value =& $gCms->modules[$key];
0
- if ($gCms->modules[$key]['installed'] == true &&
0
- $gCms->modules[$key]['active'] == true)
0
- {
0
- $gCms->modules[$key]['object']->ContentStylesheet($css);
0
- }
0
+ $css .= "/* Start of CMSMS style sheet '{$stylesheet->name}' */\n{$stylesheet->value}\n/* End of '{$stylesheet->name}' */\n";
0
+ CmsEvents::SendEvent('Core', 'ContentStylesheet', array('stylesheet' => &$stylesheet));
0
         }
0
-
0
- CmsEvents::SendEvent('Core', 'ContentStylesheet', array('stylesheet' => &$stylesheet));
0
- #}
0
+ }
0
     }
0
   }
0
- // set encoding
0
- $encoding = isset($result['encoding']) ? $result['encoding'] : 'UTF-8';
0
 }
0
-
0
 
0
 // send HTTP header
0
-header("Content-Type: text/css; charset=$encoding");
0
+header("Content-Type: text/css; charset=UTF-8");
0
 
0
 #sending content length allows HTTP/1.0 persistent connections
0
 #(and also breaks if gzip is on)

Comments

    No one has commented yet.