Merge lp:~sleszyk/vallheru/vallheru2 into lp:vallheru

Proposed by Slesz
Status: Merged
Approved by: Bartek Jasicki
Approved revision: 1720
Merge reported by: Bartek Jasicki
Merged at revision: not available
Proposed branch: lp:~sleszyk/vallheru/vallheru2
Merge into: lp:vallheru
Diff against target: 153 lines (+54/-81)
1 file modified
install/install.php (+54/-81)
To merge this branch: bzr merge lp:~sleszyk/vallheru/vallheru2
Reviewer Review Type Date Requested Status
Bartek Jasicki Pending
Review via email: mp+147343@code.launchpad.net

Description of the change

install.php permission check customization

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'install/install.php'
2--- install/install.php 2012-05-21 19:47:48 +0000
3+++ install/install.php 2013-02-08 11:13:28 +0000
4@@ -160,95 +160,68 @@
5 Test uprawnień plików oraz katalogów<br />
6 Zanim zaczniesz instalację upewnij się, że skrypt posiada uprawnienia do modyfikacji odpowiednich plików<br />
7 <?php
8+ $files_to_check = array('../includes/config.php', '../templates_c/test.php', '../avatars/test.php', '../images/tribes/test.php', '../templates_c/layout1/test.php', '../cache/test.php', '../mailer/mailerconfig.php');
9 $result = array();
10- @$configfile = fopen('../includes/config.php', 'w');
11- if (!$configfile)
12- {
13- $result[0] = "Brak uprawnień!<br />";
14- }
15- else
16- {
17- $result[0] = "W porządku<br />";
18- }
19- print "Plik includes/config.php...".$result[0];
20- @$templatescat = fopen('../templates_c/test.php', 'w');
21- if (!$templatescat)
22- {
23- $result[1] = "Brak uprawnień!<br />";
24- }
25- else
26- {
27- $result[1] = "W porządku<br />";
28- unlink('../templates_c/test.php');
29- }
30- print "Katalog templates_c...".$result[1];
31- @$avatarscat = fopen('../avatars/test.php', 'w');
32- if (!$avatarscat)
33- {
34- $result[2] = "Brak uprawnień!<br />";
35- }
36- else
37- {
38- $result[2] = "W porządku<br />";
39- unlink('../avatars/test.php');
40- }
41- print "Katalog avatars...".$result[2];
42- @$tribelogoscat = fopen('../images/tribes/test.php', 'w');
43- if (!$tribelogoscat)
44- {
45- $result[3] = "Brak uprawnień!<br />";
46- }
47- else
48- {
49- $result[3] = "W porządku<br />";
50- unlink('../images/tribes/test.php');
51- }
52- print "Katalog images/tribes...".$result[3];
53- @$layout1cat = fopen('../templates_c/layout1/test.php', 'w');
54- if (!$layout1cat)
55- {
56- $result[4] = "Brak uprawnień!<br />";
57- }
58- else
59- {
60- $result[4] = "W porządku<br />";
61- unlink('../templates_c/layout1/test.php');
62- }
63- print "Katalog templates_c/layout1...".$result[4];
64- @$cachecat = fopen('../cache/test.php', 'w');
65- if (!$cachecat)
66- {
67- $result[5] = "Brak uprawnień!<br />";
68- }
69- else
70- {
71- $result[5] = "W porządku<br />";
72- unlink('../cache/test.php');
73- }
74- print "Katalog cache...".$result[5];
75- @$mailerconf = fopen('../mailer/mailerconfig.php', 'w');
76- if (!$mailerconf)
77- {
78- $result[6] = "Brak uprawnień!<br />";
79- }
80- else
81- {
82- $result[6] = "W porządku<br />";
83- }
84- print "Plik mailer/mailerconfig.php...".$result[6];
85- $test = 0;
86- for ($i = 0; $i < 7; $i ++)
87- {
88- if ($result[$i] == "Brak uprawnień!<br />")
89+ $result_i = 0;
90+ $message = array('<td><span style="color:green">OK</span></td></tr>','<td><span style="color:red">Problem</span></td></tr>');
91+ foreach($files_to_check as $file)
92+ {
93+ if(substr($file, -8) == 'test.php')
94+ {
95+ $file = substr($file, 0, -8);
96+ }
97+ $result[$result_i] = '<tr><td>Uprawnienia do <strong>'.substr($file, 3).'</strong> : ';
98+ $result_i++;
99+ $result[$result_i] = '<em>'.substr(sprintf('%o', @fileperms($file)), -4).'</em></td>';
100+ $result_i++;
101+ if(is_dir($file))
102+ {
103+ @$file_handle = fopen($file.'test.php', 'w');
104+ }
105+ else
106+ {
107+ @$file_handle = fopen($file, 'w');
108+ }
109+ if ($file_handle)
110+ {
111+ $result[$result_i] = $message[0];
112+ }
113+ else
114+ {
115+ $result[$result_i] = $message[1];
116+ $result_i++;
117+ $result[$result_i] = '<tr><td>Próba nadania pełnych uprawnień do <strong>'.substr($file, 3).'</strong> : </td>';
118+ $result_i++;
119+ if (@chmod($file, 0777))
120+ {
121+ $result[$result_i] = $message[0];
122+ }
123+ else
124+ {
125+ $result[$result_i] = $message[1];
126+ }
127+ }
128+ $result_i++;
129+ }
130+ print '<table>';
131+ foreach($result as $print_it) {
132+ print $print_it;
133+ }
134+ print '</table>';
135+
136+ foreach($result as $this_result)
137+ {
138+ if ($this_result == $message[1])
139 {
140 print "Zanim rozpoczniesz instalację, nadaj odpowiednie uprawnienia a następnie ponownie odśwież stronę<br />
141 <form method=\"post\" action=\"install.php?step=install1\">
142 <input type=\"submit\" value=\"Odśwież\"></form>";
143- $test = 1;
144+ $test = false;
145 exit;
146 }
147+ $test = true;
148 }
149- if (!$test)
150+ if ($test == true)
151 {
152 print "<form method=\"post\" action=\"install.php?step=install2\">
153 <input type=\"submit\" value=\"Dalej >>\"></form>";

Subscribers

People subscribed via source and target branches

to status/vote changes: