$newstylesheet->name = $css_name; $newstylesheet->value = $css_text; $types = ""; #generate comma separated list foreach ($media_type as $onetype) { $types .= "{$onetype}, "; } if ($types != '') { $types = substr($types, 0, -2); #strip last space and comma } else { $types = ''; } $newstylesheet->media_type = $types; Events::SendEvent('Core', 'AddStylesheetPre', array('stylesheet' => &$newstylesheet)); $result = $newstylesheet->Save(); # we now have to check that everything went well if ($result) { #Sent the post event Events::SendEvent('Core', 'AddStylesheetPost', array('stylesheet' => &$newstylesheet)); # it's ok, we record the operation in the admin log audit($newstylesheet->id, 'Stylesheet: ' . $css_name, 'Added'); # and goes back to the css list redirect("listcss.php" . $urlext); return; } else { $error .= "<li>" . lang('errorinsertingcss') . "</li>"; } } } }