/[drupal]/contributions/modules/coolfilter/coolfilter.install
ViewVC logotype

Contents of /contributions/modules/coolfilter/coolfilter.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Thu Feb 22 04:28:29 2007 UTC (2 years, 9 months ago) by lllkkk
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-5
Changes since 1.2: +6 -5 lines
File MIME type: text/x-php
multisite
1 <?php
2 // coolfilter.install
3 /*
4 You need to install Coolfilter,before use it, as the installation in fact edit .js .php files in modules/coolfilter, your host must let php write those files, chmod 777 modules/coolfilter/*. And setup path variable above first.
5 */
6 function coolfilter_update_1 () {
7 if(variable_get("coolfilter_variable_reinstall", 0)==1){
8 if(coolfilter_install ()!=-1)
9 variable_set("coolfilter_variable_reinstall", 0);
10 }
11 }
12 function coolfilter_install () {
13
14 global $base_url;
15 /*
16 $drupal_install_path_cool is the absolute path, where drupal installed, on the server filesystem
17 Such as:/var/www/htdocs/drupal, even you use windows system also ues "/" no "\" ,like c:/www/drupal
18 If installtion get error, change it by hand.
19 */
20 $drupal_install_path_cool= getcwd();
21 $cool_http_path=base_path().drupal_get_path('module', 'coolfilter');
22 $fconfig=$drupal_install_path_cool."/".drupal_get_path('module', 'coolfilter')."/coolplayer_config.php";
23 $dpear=$drupal_install_path_cool."/".drupal_get_path('module', 'coolfilter')."/PEAR";
24 $fpear=$drupal_install_path_cool."/".drupal_get_path('module', 'coolfilter')."/coolcode.php";
25
26 //=========================
27 $fpconfig=fopen($fconfig, "r");
28 if($fpconfig===false)
29 {
30 echo "<p>Can not open ".$fconfig."</p>";
31 return -1;
32 }
33 while(!(feof($fpconfig)))
34 {
35 $trt=fgets($fpconfig);
36 if(strstr($trt, "coolplayer_pluginpath")){
37 $tr.="\$coolplayer_pluginpath= \"".drupal_get_path('module', 'coolfilter')."\";\n";
38 }
39 if(strstr($trt, "coolplayer_rpcurl")){
40 $tr.="\$coolplayer_rpcurl= \"".$cool_http_path."/rpc.php\";\n";
41 }
42 else $tr.=$trt;
43 }
44 fclose($fpconfig);
45 if(is_writable($fconfig)){
46 $fpconfig=fopen($fconfig, "w");
47 fwrite($fpconfig,$tr);
48 fclose($fpconfig);
49 }
50 else
51 {
52 echo "<p>Can not write ".$fconfig."</p>";
53 return -1;
54 }
55
56 $tr="";
57 //=========================
58 $fppear=fopen($fpear, "r");
59 if($fppear===false)
60 {
61 echo "<p>Can not open ".$fpear."</p>";
62 return -1;
63 }
64 while(!(feof($fppear)))
65 {
66 $trt=fgets($fppear);
67
68 if(strstr($trt, "pear_dir") && strstr($trt, "=")){
69 $tr.="\$pear_dir = \"".$dpear."\";\n";
70 }
71 else $tr.=$trt;
72 }
73 fclose($fppear);
74 if(is_writable($fpear)){
75 $fppear=fopen($fpear, "w");
76 fwrite($fppear,$tr);
77 fclose($fppear);
78 }
79 else
80 {
81 echo "<p>Can not write ".$fpear."</p>";
82 return -1;
83 }
84
85 $tr="";
86 unset($tr);
87
88
89 //echo "<p>Install finish. Go bac</p>";
90 return 1;
91 }
92 ?>

  ViewVC Help
Powered by ViewVC 1.1.2