project-indexer-met-nieuw-ht-bestand

Gesponsorde koppelingen

PHP script bestanden

  1. project-indexer-met-nieuw-ht-bestand

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<style type="text/css">
<!--
/*
The original subSilver Theme for phpBB version 2+
Created by subBlue design
http://www.subBlue.com
*/

body {
    background-color: #E5E5E5;
    scrollbar-face-color: #DEE3E7;
    scrollbar-highlight-color: #FFFFFF;
    scrollbar-shadow-color: #DEE3E7;
    scrollbar-3dlight-color: #D1D7DC;
    scrollbar-arrow-color: #006699;
    scrollbar-track-color: #EFEFEF;
    scrollbar-darkshadow-color: #98AAB1;
}

td {
    font-family: Verdana, Arial, Helvetica, sans-serif
}
a:link,a:active,a:visited {
    color : #006699;
}

a:hover {
    text-decoration: underline;
    color: #DD6900;
}

.forumline {
    background-color: #FFFFFF;
    border: 2px #006699 solid;
}

td.row1 {
    background-color: #EFEFEF;
}

td.row2 {
    background-color: #DEE3E7;
}

td.catHead {
    background-image: url(head.gif);
    background-color:#D1D7DC;
    border: #FFFFFF;
    border-style: solid;
    border-width: 1px 1px 0px 1px;
    color: #006699;
    height: 29px;
    font-size: 12px;
    font-weight : bold;
}

.maintitle {
    font-weight: bold;
    font-size: 26px;
    font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
    text-decoration: none;
    line-height: 120%;
    color: #000000;
}

.genmed {
    font-size: 11px;
    color: #000000;
    font-weight: bold;
}

a.genmed {
    color: #006699;
    text-decoration: none;
    font-weight: bold;
}

a.genmed:hover {
    color: #DD6900;
    text-decoration: underline;
    font-weight: bold;
}
-->
</style>
<?php
// functie get_stats
// returneerd de aantal bestanden in een map, aantal submappen en de groote van de map

function get_stats($dir)
{

    $total['files'] = 0;
    $total['folders'] = 0;
    $total['size'] = 0;

    $handle = opendir($dir);
    while(false !==($read = readdir($handle)))
    {

        if($read != '.' && $read != '..')
        {

            if(is_file($dir . $read))
            {

                $total['files']++;
                $total['size'] += filesize($dir .'/'. $read);
            }

            elseif(is_dir($dir . $read))
            {

                $total['folders']++;
                $count = get_stats($dir . $read . '/');
                $total['files'] += $count['files'];
                $total['folders'] += $count['folders'];
                $total['size'] += $count['size'];
            }
        }
    }

    return $total;
}


// Converteerd bytes naar Mb, Gb en Tb
// alhoewel denk niet dat Tb zo makkelijk voor komt :P

function Size($bytes, $comma = 1)
{

    global $l_mb, $l_gb, $l_tb;

    if($bytes >= 0 && $bytes < 1073741824)// Omrekenen naar Megabytes
    {
        $bytes = ($bytes != 0) ? $bytes / 1048576 : 0;
        $type = $l_mb;
    }

    elseif($bytes >= 1073741824 && $bytes < 1099511627776)// Omrekenen naar Gigabytes
    {
        $bytes = $bytes / 1073741824;
        $type = $l_gb;
    }

    elseif($bytes >= 1099511627776)// Omrekenen naar Terabytes
    {
        $bytes = $bytes / 1099511627776;
        $type = $l_tb;
    }

    else// Niet omgerekend, type is megabyte
    {
        $bytes = $bytes / 1048576;
        $type = $l_mb;
    }


    $bytes = round($bytes + 0.0001 / pow(10, $comma), $comma);
    $return = array('bytes' => $bytes, 'type' => $type);
    return $return;
}


// Dit zijn de taal variables
$l_title = "Superaktieboy's Projecten";
$l_pj_name = "Project naam";
$l_finished = "Klaar";
$l_files = "Bestanden";
$l_folders = "Mappen";
$l_size = "Grootte";
$l_description = "beschrijving";
$l_languages = "Taal";
$l_yes = "Ja";
$l_no = "Nee";
$l_none = 'Geen';
$l_def_language = "Nederlands";
$l_mb = "Mb";
$l_gb = "Gb";
$l_tb = "Tb";

// Aller eerst de hoofd laten zien
echo "<center><span class=\"maintitle\">".$l_title."</span></center><br />
<table width=\"100%\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\" class=\"forumline\">
 <tr>
  <td class=\"catHead\" height=\"25\" align=\"center\" width=\"15%\"><span class=\"genmed\">"
.$l_pj_name."</span></td>
  <td class=\"catHead\" height=\"25\" align=\"center\" width=\"05%\"><span class=\"genmed\">"
.$l_finished."</span></td>
  <td class=\"catHead\" height=\"25\" align=\"center\" width=\"05%\"><span class=\"genmed\">"
.$l_files."</span></td>
  <td class=\"catHead\" height=\"25\" align=\"center\" width=\"05%\"><span class=\"genmed\">"
.$l_folders."</span></td>
  <td class=\"catHead\" height=\"25\" align=\"center\" width=\"05%\"><span class=\"genmed\">"
.$l_size."</span></td>
  <td class=\"catHead\" height=\"25\" align=\"center\" width=\"50%\"><span class=\"genmed\">"
.$l_description."</span></td>
  <td class=\"catHead\" height=\"25\" align=\"center\" width=\"20%\"><span class=\"genmed\">"
.$l_languages."</span></td>
 </tr>"
;

// voor de projecten die niet een map zitten eerst die echoen
include './.htproject';
// rij kleur, gebruikt voor klasse, zie de css hierboven
$row = 1;
foreach($no_sub_array as $nsa_pj_name => $nsa_pj_settings_array)
{

    $nsa_finished = $nsa_pj_settings_array['finished'];
    // hier selecteren we wat er komt te staat als klaar of niet klaar
    $nsa_finish_txt = ($nsa_finished == true && !is_numeric($nsa_finished)) ? $l_yes : (($nsa_finished == false && !is_numeric($nsa_finished)) ? $l_no : $nsa_finished.'%');
    // grootte berekenen met de Size() functie
    $nsa_size = Size(filesize($nsa_pj_settings_array['filename']), 2);
    $nsa_pj_total_size = $nsa_size['bytes'].'&nbsp;'.$nsa_size['type'];
    // alle talen selecteren
    $nsa_tmp_langs = $nsa_pj_settings_array['languages'];
    $nsa_languages = array();
    for($i = 0; $i < count($nsa_tmp_langs); $i++)
    {

        $nsa_lang_link = $nsa_tmp_langs[$i][0];
        $nsa_lang_name = $nsa_tmp_langs[$i][1];
        // is er een link voor de taal ofniet?
        $nsa_languages[] = ($nsa_lang_link == '') ? $nsa_lang_name : '<a href="'.$nsa_lang_link.'">'.$nsa_lang_name.'</a>';
    }

    // is er wel minimaal een taal? anders maak ervan de standaard taal
    if(count($nsa_languages) == 0)
    {

        $nsa_languages[] = $l_def_language;
    }

    // geef ze allemaal een ", " ervoor
    $nsa_languages = implode(', ', $nsa_languages);
    // aantal bestanden
    $nsa_files = ($nsa_pj_settings_array['files'] > 0) ? $nsa_pj_settings_array['files'] : 1;
    // alles laten zien
    echo "
 <tr>
  <td class=\"row$row\" height=\"25\" width=\"15%\"><span class=\"genmed\"><a href=\""
.$dir.$nsa_pj_settings_array['filename']."\" target=\"_self\">$nsa_pj_name</a></span></td>
  <td class=\"row$row\" height=\"25\" align=\"center\"><span class=\"genmed\">"
.$nsa_finish_txt."</span></td>
  <td class=\"row$row\" height=\"25\" align=\"center\"><span class=\"genmed\">"
.$nsa_files."</span></td>
  <td class=\"row$row\" height=\"25\" align=\"center\"><span class=\"genmed\">"
.$l_none."</span></td>
  <td class=\"row$row\" height=\"25\" align=\"center\"><span class=\"genmed\">"
.$nsa_pj_total_size."</span></td>
  <td class=\"row$row\" height=\"25\" align=\"center\"><span class=\"genmed\">"
.$nsa_pj_settings_array['description']."</span></td>
  <td class=\"row$row\" height=\"25\"><span class=\"genmed\">"
.$nsa_languages."</span></td>
 </tr>"
;
    // verander de rij kleur
    $row = ($row == 1) ? 2 : 1;
}


// loop nu alle mappen van deze map door
$dir = './';
if ($handle = opendir($dir))
{

    // rij is al eerder geselecteerd, dus hoeft niet meer
    // $row = ($row == 1) ? 1 : 2;

    while (false !== ($file = readdir($handle)))
    {

        // selecteer alleen de mappen
        if(is_dir($file) && $file != '.' && $file != '..')
        {

            // include de .htproject van elke map
            include $dir.$file."/.htproject";
            // als we deze project mogen echo'en doe echo de project
            if(!$pj_ignore)
            {

                // selecteer weer alle talen
                $languages = array();
                for($i = 0;$i < count($pj_language);$i++)
                {

                    $tmp_lang_link = $pj_language[$i][0];
                    $tmp_lang_name = $pj_language[$i][1];
                    // is er een link voor de taal of niet
                    $languages[] = ($tmp_lang_link == '') ? $tmp_lang_name : '<a href="'.$dir.$file.'/'.$tmp_lang_link.'">'.$tmp_lang_name.'</a>';
                }

                // zijn er wel talen geselecteerd? zo niet dan selecteer de standaard taal
                if(count($languages) == 0)
                {

                    $languages[] = $l_def_language;
                }

                $languages = implode(', ', $languages);
                // selecteer de 'klaar' tekst
                $finish_txt = ($pj_is_finished == true && !is_numeric($pj_is_finished)) ? $l_yes : (($pj_is_finished == false && !is_numeric($pj_is_finished)) ? $l_no : $pj_is_finished.'%');
                // haal de statistieken op
                $stats = get_stats($dir.$file."/");
                $pj_total_files = $stats['files'];
                $pj_total_folders = $stats['folders'];
                // selecteer de grootte
                $size = Size($stats['size'], 2);
                $pj_total_size = $size['bytes'].'&nbsp;'.$size['type'];
                // laat alles zien
                echo "
 <tr>
  <td class=\"row$row\" height=\"25\" width=\"15%\"><span class=\"genmed\"><a href=\""
.$dir.$file."/\" target=\"_self\">".$pj_name."</a></span></td>
  <td class=\"row$row\" height=\"25\" align=\"center\"><span class=\"genmed\">"
.$finish_txt."</span></td>
  <td class=\"row$row\" height=\"25\" align=\"center\"><span class=\"genmed\">"
.($pj_total_files-1)."</span></td>
  <td class=\"row$row\" height=\"25\" align=\"center\"><span class=\"genmed\">"
.$pj_total_folders."</span></td>
  <td class=\"row$row\" height=\"25\" align=\"center\"><span class=\"genmed\">"
.$pj_total_size."</span></td>
  <td class=\"row$row\" height=\"25\" align=\"center\"><span class=\"genmed\">"
.$pj_description."</span></td>
  <td class=\"row$row\" height=\"25\"><span class=\"genmed\">"
.$languages."</span></td>
 </tr>"
;
                // verander de rij kleur
                $row = ($row == 1) ? 2 : 1;
            }
        }
    }
}

echo "<table>";
?>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.