Subversion Repositories Applications.papyrus

Rev

Rev 1087 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
831 florian 1
<?php
2
/* generateStaticCSS.php
3
 * this script is meant to be run from the command-line
4
 * it extracts the CSS-data from the templates and will write it to a static file
5
 * keep in mind that you'll have to run it by hand if your color-settings change!!!
6
 *
7
 * for using that script you have either to use the chdir call or put it in the phorum-dir
8
 * keep in mind that others could use this script to overwrite files on your webserver
9
 * therefore there is the first exit(); in there, you have to remove it to use the script too
10
 *
11
 * to have Phorum use the static CSS, you'll have to edit header.tpl, instead the include of the css
12
 * you have to use a link href ...
13
 */
14
 
15
 // that's here for security measures, remove it if you want to use the script!!!
16
 exit();
17
 
18
 //chdir("../");
19
 
20
include './common.php';
21
 
22
if($argc < 2) {
23
    echo "needs 2 parameters, first as forum-id, second as filename (including path) of the css to be generated.\n";
24
    exit();
25
}
26
 
27
// the second arg is the filename
28
$filepath=$argv[2];
29
 
30
if(is_dir($filename)) {
31
    echo "the second argument has to be a filename and no directory!\n";
32
    exit();
33
}
34
 
35
echo "Generating static CSS-file for Forum ".$PHORUM['forum_id']."\n";
36
 
37
ob_start();
38
include phorum_get_template('css');
39
$css_str=ob_get_contents();
40
ob_end_clean();
41
 
42
echo "writing CSS-file to ".$filepath.".\n";
43
 
44
$fp=fopen($filepath,"w");
45
fputs($fp,$css_str);
46
fclose($fp);
47
 
48
?>