]> git.sur5r.net Git - bacula/docs/blob - docs/home-page/en/pages/testimonial.php
update home page
[bacula/docs] / docs / home-page / en / pages / testimonial.php
1 <? 
2 require_once("inc/header.php"); 
3
4 $dat_dir = '/var/www/testimonials';
5 $upload_dir = '/var/www/bacula';
6 $password='';
7 // 0 No
8 // 1 Yes
9 $org_type_lst = array(
10        'empty'   => "SELECT ONE",
11        '100' => "Church / Religious Organization",
12        '101' => "Corporation",
13        '102' => "Educational Institution",
14        '103' => "Government",
15        '104' => "Military",
16        '105' => "Non-Profit Organization",
17        '107' => "Small Business",
18        '106' => "Other"
19 );
20
21 $version_lst = array(
22        'empty'   => "SELECT ONE",
23        '208'   => "5.0.x",
24        '207'   => "3.0.x",
25        '200'   => "1.36.x",
26        '201'   => "1.38.x",
27        '202'   => "2.0.x",
28        '203'   => "2.2.x",
29        '206'   => "2.4.x",
30        '204'   => "GIT master version"
31 );
32
33 $catalog_lst = array(
34        'empty'   => "SELECT ONE",
35        '300'   => "MySQL",
36        '301'   => "PostgreSQL",
37        '303'   => "SqLite"
38 );
39
40 $org_industry_lst = array(
41  'empty'   => 'SELECT ONE',                     '400'  => 'Aerospace / Aeronautical',
42  '401'  => 'Agriculture / Farming',             '402'  => 'Architecture / Design',
43  '403'  => 'Arts',                              '404'  => 'ASP',
44  '405'  => 'Banking',
45  '406'  => 'Church / Religious Organization',   '407'  => 'Coaching',
46  '408'  => 'Construction',                      '409'  => 'Consulting (General)',
47  '410'  => 'Consulting (Information Technology)','411' => 'Defense Industry',
48  '412'  => 'Education / Training',              '413'  => 'Energy Industry',
49  '414'  => 'Engineering',                       '415'  => 'Entertainment (Film)',
50  '416'  => 'Entertainment (Music)',             '417'  => 'Entertainment (Other)',
51  '418'  => 'Event Management / Conferences',    '419'  => 'Finance / Banking / Accounting',
52  '420'  => 'Food Service Industry',             '421'  => 'Government',
53  '422'  => 'Healthcare / Medicine',             '423'  => 'Higher Education',
54  '424'  => 'Insurance',                         '425'  => 'Internet Service Provider',
55  '426'  => 'K-12 Education',                    '427'  => 'Law Enforcement / Emergency Management',
56  '428'  => 'Legal',                             '429'  => 'Manufacturing (Computer Equipment)',
57  '430'  => 'Manufacturing (General)',           '431'  => 'Media (Publishing, Broadcasting, etc)',
58  '432'  => 'Military',                          '433'  => 'Mining',
59  '434'  => 'Natural Resources / Environment',   '435'  => 'Pharmaceuticals',
60  '436'  => 'Public Relations / Advertising',    '437'  => 'Real Estate',
61  '438'  => 'Retail / Consumer Goods',           '439'  => 'Sales / Marketing',
62  '440'  => 'Scientific Research',               '441'  => 'Sports / Recreation',
63  '442'  => 'Technical College / Trade School',  '443'  => 'Telecommunications',
64  '444'  => 'Transportation Industry (Air)',     '445'  => 'Transportation Industry (General)',
65  '446'  => 'Transportation Industry (Marine)',  '447'  => 'Travel / Tourism / Lodging',
66  '448'  => 'Travel Industry',                   '449'  => 'Utilities / Public Works',
67  '450'  => 'Other'                             
68 );
69
70 $os_lst = array(
71    'empty'  =>  'SELECT ONE',        '500' =>  'AIX',
72    '501' =>  'FreeBSD',              '502' =>  'HP-UX',
73    '503' =>  'Linux (Debian)',       '504' =>  'Linux (Fedora)',
74    '505' =>  'Linux (Gentoo)',       '506' =>  'Linux (Mandriva)',
75    '507' =>  'Linux (Other)',        '508' =>  'Linux (RedHat)',
76    '509' =>  'Linux (Slackware)',    '510' =>  'Linux (Suse)',
77    '511' =>  'Mac OS X',             '512' =>  'NetBSD',
78    '513' =>  'OpenBSD',              '514' =>  'Other',
79    '515' =>  'Solaris',              '516' =>  'Windows 2000',
80    '517' =>  'Windows 2003',         '518' =>  'Windows XP',
81    '519' =>  'Windows Vista'
82 ); 
83
84 $country_lst = array(
85    'empty' =>  'SELECT ONE',              '1001'  =>  'Afghanistan',
86    '1002'  =>  'Albania',                 '1003'  =>  'Algeria',
87    '1004'  =>  'American Samoa',          '1005'  =>  'Andorra',
88    '1006'  =>  'Angola',                  '1007'  =>  'Anguilla',
89    '1008'  =>  'Antarctica',              '1009'  =>  'Antigua and Barbuda',
90    '1010'  =>  'Argentina',               '1011'  =>  'Armenia',
91    '1012'  =>  'Aruba',                   '1013'  =>  'Australia',
92    '1014'  =>  'Austria',                 '1015'  =>  'Azerbaijan',
93    '1016'  =>  'Bahamas',                 '1017'  =>  'Bahrain',
94    '1018'  =>  'Bangladesh',              '1019'  =>  'Barbados',
95    '1020'  =>  'Belarus',                 '1021'  =>  'Belgium',
96    '1022'  =>  'Belize',                  '1023'  =>  'Benin',
97    '1024'  =>  'Bermuda',                 '1025'  =>  'Bhutan',
98    '1026'  =>  'Bolivia',                 '1027'  =>  'Bosnia and Herzegovina',
99    '1028'  =>  'Botswana',                '1029'  =>  'Bouvet Island',
100    '1030'  =>  'Brazil',                  '1031'  =>  'Brunei Darussalam',
101    '1032'  =>  'Bulgaria',                '1033'  =>  'Burkina Faso',
102    '1034'  =>  'Burundi',                 '1035'  =>  'Cambodia',
103    '1036'  =>  'Cameroon',                '1037'  =>  'Canada',
104    '1038'  =>  'Cape Verde',              '1039'  =>  'Cayman Islands',
105    '1040'  =>  'Central African Republic','1041'  =>  'Chad',
106    '1042'  =>  'Chile',                   '1043'  =>  'China',
107    '1044'  =>  'Christmas Island',        '1045'  =>  'Colombia',
108    '1046'  =>  'Comoros',                 '1047'  =>  'Congo',
109    '1048'  =>  'Cook Islands',            '1049'  =>  'Costa Rica',
110    '1054'  =>  "Ivory Coast",             '1050'  =>  'Croatia',
111    '1051'  =>  'Cuba',                    '1052'  =>  'Cyprus',
112    '1053'  =>  'Czech Republic',          '1055'  =>  'Denmark',
113    '1056'  =>  'Djibouti',                '1057'  =>  'Dominica',
114    '1058'  =>  'Dominican Republic',      '1059'  =>  'East Timor',
115    '1060'  =>  'Ecuador',                 '1061'  =>  'Egypt',
116    '1062'  =>  'El Salvador',             '1063'  =>  'Equatorial Guinea',
117    '1064'  =>  'Eritrea',                 '1065'  =>  'Estonia',
118    '1066'  =>  'Ethiopia',                '1067'  =>  'Falkland Islands',
119    '1068'  =>  'Faroe Islands',           '1069'  =>  'Fiji',
120    '1070'  =>  'Finland',                 '1071'  =>  'France',
121    '1072'  =>  'French Guiana',           '1073'  =>  'French Polynesia',
122    '1074'  =>  'Gabon',                   '1075'  =>  'Gambia',
123    '1076'  =>  'Georgia',                 '1077'  =>  'Germany',
124    '1078'  =>  'Ghana',                   '1079'  =>  'Gibraltar',
125    '1080'  =>  'Greece',                  '1081'  =>  'Greenland',
126    '1082'  =>  'Grenada',                 '1083'  =>  'Guadeloupe',
127    '1084'  =>  'Guam',                    '1085'  =>  'Guatemala',
128    '1086'  =>  'Guinea',                  '1087'  =>  'Guinea-Bissau',
129    '1088'  =>  'Guyana',                  '1089'  =>  'Haiti',
130    '1090'  =>  'Honduras',                '1091'  =>  'Hong Kong',
131    '1092'  =>  'Hungary',                 '1093'  =>  'Iceland',
132    '1094'  =>  'India',                   '1095'  =>  'Indonesia',
133    '1096'  =>  'Iran',                    '1097'  =>  'Iraq',
134    '1098'  =>  'Ireland',                 '1099'  =>  'Israel',
135    '1100'  =>  'Italy',                    '1101' =>  'Jamaica',
136    '1102'  =>  'Japan',                    '1103' =>  'Jordan',
137    '1104'  =>  'Kazakstan',                '1105' =>  'Kenya',
138    '1106'  =>  'Kiribati',                 '1107' =>  'Kuwait',
139    '1108'  =>  'Kyrgystan',                '1109' =>  'Lao',
140    '1110'  =>  'Latvia',                   '1111' =>  'Lebanon',
141    '1112'  =>  'Lesotho',                  '1113' =>  'Liberia',
142    '1232'  =>  'Libya',                    '1114' =>  'Liechtenstein',
143    '1115'  =>  'Lithuania',                '1116' =>  'Luxembourg',
144    '1117'  =>  'Macau',                    '1118' =>  'Macedonia (FYR)',
145    '1119'  =>  'Madagascar',               '1120' =>  'Malawi',
146    '1121'  =>  'Malaysia',                 '1122' =>  'Maldives',
147    '1123'  =>  'Mali',                     '1124' =>  'Malta',
148    '1125'  =>  'Marshall Islands',         '1126' =>  'Martinique',
149    '1127'  =>  'Mauritania',               '1128' =>  'Mauritius',
150    '1129'  =>  'Mayotte',                  '1130' =>  'Mexico',
151    '1131'  =>  'Micronesia',               '1132' =>  'Moldova',
152    '1133'  =>  'Monaco',                   '1134' =>  'Mongolia',
153    '1135'  =>  'Montserrat',               '1136' =>  'Morocco',
154    '1137'  =>  'Mozambique',               '1138' =>  'Myanmar',
155    '1139'  =>  'Namibia',                  '1140' =>  'Nauru',
156    '1141'  =>  'Nepal',                    '1142' =>  'Netherlands',
157    '1143'  =>  'Netherlands Antilles',     '1144' =>  'Neutral Zone',
158    '1145'  =>  'New Caledonia',            '1146' =>  'New Zealand',
159    '1147'  =>  'Nicaragua',                '1148' =>  'Niger',
160    '1149'  =>  'Nigeria',                  '1150' =>  'Niue',
161    '1151'  =>  'Norfolk Island',           '1152' =>  'North Korea',
162    '1153'  =>  'Northern Mariana Islands', '1154' =>  'Norway',
163    '1155'  =>  'Oman',                     '1156' =>  'Pakistan',
164    '1157'  =>  'Palau',                    '1158' =>  'Panama',
165    '1159'  =>  'Papua New Guinea',         '1160' =>  'Paraguay',
166    '1161'  =>  'Peru',                     '1162' =>  'Philippines',
167    '1163'  =>  'Pitcairn',                 '1164' =>  'Poland',
168    '1165'  =>  'Portugal',                 '1166' =>  'Puerto Rico',
169    '1167'  =>  'Qatar',                    '1168' =>  'Reunion',
170    '1169'  =>  'Romania',                  '1170' =>  'Russian Federation',
171    '1171'  =>  'Rwanda',                   '1172' =>  'Saint Helena',
172    '1173'  =>  'Saint Kitts and Nevis',    '1174' =>  'Saint Lucia',
173    '1175'  =>  'Saint Pierre and Miquelon','1231' =>  'Saint Vincent and the Grenadines',
174    '1176'  =>  'Samoa',                    '1177' =>  'San Marino',
175    '1178'  =>  'Sao Tome and Principe',    '1179' =>  'Saudi Arabia',
176    '1180'  =>  'Senegal',                  '1227' =>  'Serbia and Montenegro',
177    '1181'  =>  'Seychelles',               '1182' =>  'Sierra Leone',
178    '1183'  =>  'Singapore',                '1184' =>  'Slovakia',
179    '1185'  =>  'Slovenia',                 '1186' =>  'Solomon Islands',
180    '1187'  =>  'Somalia',                  '1188' =>  'South Africa',
181    '1189'  =>  'South Georgia',            '1190' =>  'South Korea',
182    '1191'  =>  'Spain',                    '1192' =>  'Sri Lanka',
183    '1193'  =>  'Sudan',                    '1194' =>  'Suriname',
184    '1195'  =>  'Swaziland',                '1196' =>  'Sweden',
185    '1197'  =>  'Switzerland',              '1198' =>  'Syria',
186    '1199'  =>  'Taiwan',                   '1200' =>  'Tajikistan',
187    '1201'  =>  'Tanzania',                 '1202' =>  'Thailand',
188    '1203'  =>  'Togo',                     '1204' =>  'Tokelau',
189    '1205'  =>  'Tonga',                    '1206' =>  'Trinidad and Tobago',
190    '1207'  =>  'Tunisia',                  '1208' =>  'Turkey',
191    '1209'  =>  'Turkmenistan',             '1210' =>  'Turks and Caicos Islands',
192    '1211'  =>  'Tuvalu',                   '1212' =>  'Uganda',
193    '1213'  =>  'Ukraine',                  '1214' =>  'United Arab Emirates',
194    '1215'  =>  'United Kingdom',           '1216' =>  'United States of America',
195    '1217'  =>  'Uruguay',                  '1218' =>  'Uzbekistan',
196    '1219'  =>  'Vanuatu',                  '1233' =>  'Vatican City',
197    '1220'  =>  'Venezuela',                '1221' =>  'Vietnam',
198    '1222'  =>  'Virgin Islands (British)', '1223' =>  'Virgin Islands (U.S.)',
199    '1224'  =>  'Wallis and Futuna Islands','1225' =>  'Western Sahara',
200    '1226'  =>  'Yemen',                    '1228' =>  'Zaire',
201    '1229'  =>  'Zambia',                   '1230' =>  'Zimbabwe'
202 );
203
204 admin_link();
205
206 if ($_REQUEST['action'] == 'Add' or $_REQUEST['action'] == 'Modify')
207 {
208
209 ?>
210
211 <script type="text/javascript" language="JavaScript">
212
213 function validate_testimonial () {
214     var alertstr = '';
215     var invalid  = 0;
216     var invalid_fields = new Array();
217     var ok;
218     var form = document.forms['form1'];
219     // email: standard text, hidden, password, or textarea box
220     var email = form.elements['email_address'].value;
221     if (email == null || ! email.match(/^[\w\-\+\._]+\@[a-zA-Z0-9][-a-zA-Z0-9\.]*\.[a-zA-Z]+$/)) {
222         alertstr += '- Invalid entry for the "Email" field\n';
223         invalid++;
224         invalid_fields.push('email_address');
225     }
226
227     // contact_name: standard text, hidden, password, or textarea box
228     var contact_name = form.elements['contact_name'].value;
229     if (contact_name == null || ! contact_name.match(/^[a-zA-Z]+[- ]?[a-zA-Z]+\s*,?([a-zA-Z]+|[a-zA-Z]+\.)?$/)) {
230         alertstr += '- Invalid entry for the "Contact Name" field\n';
231         invalid++;
232         invalid_fields.push('contact_name');
233     }
234
235     // org_name: standard text, hidden, password, or textarea box
236     var org_name = form.elements['org_name'].value;
237     if (org_name == null || ! org_name.match(/^[a-zA-Z0-9();@%, :!\/]+$/)) {
238         alertstr += '- Invalid entry for the "Organization Name" field\n';
239         invalid++;
240         invalid_fields.push('org_name');
241     }
242     var number = form.elements['orgtype_id'].value;
243     if (number == null || ! number.match(/^[0-9]+$/)) {
244         alertstr += '- Choose one of the "Organization type" options\n';
245         invalid_fields.push('orgtype_id');
246         invalid++;
247     } 
248     number = form.elements['orgindustry_id'].value;
249     if (number == null || ! number.match(/^[0-9]+$/)) {
250         alertstr += '- Choose one of the "Organization industry type" options\n';
251         invalid_fields.push('orgindustry_id');
252         invalid++;
253     }
254     var org_size = form.elements['org_size'].value;
255     if (org_size == null || ! org_size.match(/^[0-9,\.]+$/)) {
256         alertstr += '- Invalid entry for the "Organization size" field\n';
257         invalid_fields.push('org_size');
258         invalid++;
259     }
260
261     var bacula_version = form.elements['bacula_version'].value;
262     if (bacula_version == null || ! bacula_version.match(/^[0-9]+$/)) {
263         alertstr += '- Invalid entry for the "Bacula version" field\n';
264         invalid_fields.push('bacula_version');
265         invalid++;
266     }
267     var ostype = form.elements['ostype_id'].value;
268     if (ostype == null || ! ostype.match(/^[0-9]+$/)) {
269         alertstr += '- Choose one of the "Director OS" field\n';
270         invalid_fields.push('ostype_id');
271         invalid++;
272     }
273     var catalog = form.elements['catalog_id'].value;
274     if (catalog == null || ! catalog.match(/^[0-9]+$/)) {
275         alertstr += '- Choose one of the "Catalog type" field\n';
276         invalid_fields.push('catalog_id');
277         invalid++;
278     }
279     var comments = form.elements['comments'].value;
280     if (comments != null && comments.match(/http:\/\//)) {
281         alertstr += '- Invalid entry for the "Comments" field, we disallow spam url\n';
282         invalid_fields.push('comments');
283         invalid++;
284     }
285     comments = form.elements['hardware_comments'].value;
286     if (comments != null && comments.match(/http:\/\//)) {
287         alertstr += '- Invalid entry for the "Hardware comments" field, we disallow spam url\n';
288         invalid_fields.push('hardware_comments');
289         invalid++;
290     }
291     var number = form.elements['number_fd'].value;
292     if (number == null || ! number.match(/^[0-9,\.]+$/)) {
293         alertstr += '- Invalid entry for the "Number of Client" field\n';
294         invalid_fields.push('number_fd');
295         invalid++;
296     } 
297     number = form.elements['number_sd'].value;
298     if (number == null || ! number.match(/^[0-9,\.]+$/)) {
299         alertstr += '- Invalid entry for the "Number of Storage" field\n';
300         invalid_fields.push('number_sd');
301         invalid++;
302     } 
303     number = form.elements['number_dir'].value;
304     if (number == null || ! number.match(/^[0-9,\.]+$/) || number > 100) {
305         alertstr += '- Invalid entry for the "Number of Director" field\n';
306         invalid_fields.push('number_dir');
307         invalid++;
308     } 
309     number = form.elements['month_gb'].value;
310     if (number == null || ! number.match(/^[0-9,\.]+$/)) {
311         alertstr += '- Invalid entry for the "Number GB/month" field\n';
312         invalid_fields.push('month_gb');
313         invalid++;
314     } 
315     number = form.elements['number_files'].value;
316     if (number == null || ! number.match(/^[0-9,\.]+$/)) {
317         alertstr += '- Invalid entry for the "File number" field\n';
318         invalid_fields.push('number_files');
319         invalid++;
320     }
321     if (invalid > 0 || alertstr != '') {
322         if (! invalid) invalid = 'The following';   // catch for programmer error
323         alert(''+invalid+' error(s) were encountered with your submission:'+'\n\n'
324                 +alertstr+'\n'+'Please correct these fields and try again.');
325         return false;
326     }
327     return true;  // all checked ok
328 }
329
330 </script>
331 <table>
332 <tr>
333         <td class="contentTopic">
334                 <? echo $_REQUEST['action'] ?> Testimonial
335         </td>
336 </tr>
337 <tr>
338         <td class="content">
339
340 Want to let others know you're using Bacula? Submit a user profile!  Your
341 submission will be reviewed before being made publicly available.  We reserve
342 the right to edit your submission for spelling, grammar, etc. You will receive
343 an email when your profile has been approved for public viewing. Note that
344 while your contact name and email address are required (to verify
345 information if necessary), you can choose to have them not be published along
346 with your profile information.  
347 <br/><br/>
348 Fields marked with a * are required. Read the privacy notice below for
349 information about how this data will be used.
350
351         </td>
352 </tr>
353
354 <tr>
355         <td class="content">
356 <form name='form1' enctype="multipart/form-data" method='post' action='?page=testimonial'>
357 <input type='hidden' name='page' value='testimonial'>
358 <table border='0' class='Content'>
359
360 <td class='ItemName'>
361 <font color='red'>*</font>Contact Name:</td>
362 <td class='ItemValue'><input type='text' class='ItemValue' id='contact_name' 
363 name='contact_name' size='30' maxlength='100' value=''></td>
364 <td class='ItemName'>Publish Contact Name?</td>
365 <td class='ItemValue'><select name='publish_contact' class='ItemValue'>
366 <option id='publish_contact_0'  value='0' SELECTED>No
367 <option id='publish_contact_1' value='1'>Yes
368 </select></td>
369 </tr>
370
371 <tr>
372 <td class='ItemName'><font color='red'>*</font>Email Address:</td>
373 <td class='ItemValue'><input type='text' class='ItemValue' name='email_address' 
374 id='email_address' size='30' maxlength='150' value=''></td>
375 <td class='ItemName'>Publish Email Address?</td><td class='ItemValue'>
376 <select name='publish_email' class='ItemValue'>
377 <option value='0' id='publish_email_0' SELECTED>No
378 <option value='1' id='publish_email_1' >Yes
379 </select></td>
380 </tr>
381
382 <tr><td class='ItemName'>Job Description/Title:</td>
383 <td class='ItemValue'>
384 <input type='text' name='title' id='title' size='30' maxlength='100' value=''></td></tr>
385 <tr><td colspan=4><br></td></tr>
386
387 <tr><td class='ItemName'><font color='red'>*</font>Organization Name:</td>
388 <td class='ItemValue'>
389 <input type='text' class='ItemValue' name='org_name' id='org_name' 
390 size='30' maxlength='100' value=''>
391 </td><td class='ItemName'>Publish Org Name?</td><td class='ItemValue'>
392 <select name='publish_orgname' class='ItemValue'>
393 <option value='0' id='publish_orgname_0' >No
394 <option value='1' id='publish_orgname_1' SELECTED>Yes
395 </select></td>
396 </tr>
397
398 <tr><td class='ItemName'><font color='red'>*</font>Organization Type:</td>
399 <td class='ItemValue' colspan='3'>
400 <select name='orgtype_id' class='ItemValue'>
401 <?
402
403 while(list ($key, $val) = each ($org_type_lst))
404 {
405  echo "<option id='orgtype_id_$key' value='$key'>$val\n";
406 }
407
408 ?>
409 </select>
410 </td></tr>
411
412 <tr><td class='ItemName'><font color='red'>*</font>Organization Industry/Function:</td>
413 <td class='ItemValue' colspan='3'>
414 <select name='orgindustry_id' class='ItemValue'>
415 <?
416
417 while(list ($key, $val) = each ($org_industry_lst))
418 {
419  echo "<option id='orgindustry_id_$key' value='$key'>$val\n";
420 }
421
422 ?>
423 </select>
424 </td></tr>
425
426 <tr><td class='ItemName'>
427 <font color='red'>*</font>Approx. Organization Size (# of Users):</td>
428 <td class='ItemValue'>
429 <input type='text' id='org_size' class='ItemValue' name='org_size' 
430 size='4' maxlength='6' value=''></td>
431 <td class='ItemName'>Publish Org Size?</td><td class='ItemValue'><select name='publish_orgsize' class='ItemValue'>
432 <option id='publish_orgsize_0' value='0' >No
433 <option id='publish_orgsize_1' value='1' SELECTED>Yes
434 </select></td>
435 </tr>
436 <tr>
437
438 <td class='ItemName'>Website URL:</td>
439 <td class='ItemValue'>
440 <input type='text' class='ItemValue' id='website' name='website' size='30'
441  maxlength='150' value=''></td>
442 <td class='ItemName'>Publish Website?</td><td class='ItemValue'>
443 <select name='publish_website' class='ItemValue'>
444 <option id='publish_website_0' value='0' >No
445 <option id='publish_website_1' value='1' SELECTED>Yes
446 </select></td>
447 </tr>
448
449 <tr>
450 <td class='ItemName'>Organization Logo :</td>
451 <td class='ItemValue'>
452 <input type="file" name="org_logo" title="png, gif or jpeg file only please"/>
453 </td><td><i>max width 150px. png, gif or jpeg only</i></td>
454 </tr>
455
456 <tr><td class='ItemName'><font color='red'>*</font>Country:</td>
457 <td class='ItemValue'>
458 <select name='country_id' class='ItemValue'>
459 <?
460 while(list ($key, $val) = each ($country_lst))
461 {
462  echo "<option id='country_id_$key' value='$key'>$val\n";
463 }
464
465 ?>
466 </select>
467 </td></tr>
468
469 <tr><td colspan=4><br></td></tr>
470 <tr><td class='ItemName'><font color='red'>*</font>Bacula version:</td>
471 <td class='ItemValue'>
472 <select name='bacula_version' class='ItemValue'>
473 <?
474
475 while(list ($key, $val) = each ($version_lst))
476 {
477  echo "<option id='bacula_version_$key' value='$key'>$val\n";
478 }
479
480 ?>
481 </select>
482 </td></tr>
483 <tr><td class='ItemName'><font color='red'>*</font>Director OS:</td>
484 <td class='ItemValue'>
485 <select name='ostype_id' class='ItemValue'>
486 <?
487
488 while(list ($key, $val) = each ($os_lst))
489 {
490  echo "<option id='ostype_id_$key' value='$key'>$val\n";
491 }
492
493 ?>
494 </select>
495 </td></tr>
496 <tr><td class='ItemName'><font color='red'>*</font>Catalog DB:</td>
497 <td class='ItemValue'>
498 <select name='catalog_id' class='ItemValue'>
499 <?
500
501 while(list ($key, $val) = each ($catalog_lst))
502 {
503  echo "<option id='catalog_id_$key' value='$key'>$val\n";
504 }
505
506 ?>
507 </select>
508 </td></tr>
509 <tr>
510 <td class='ItemName'><font color='red'>*</font>Redundant/Failover Backup Setup?</td>
511 <td class='ItemValue'><select name='redundant_setup' class='ItemValue'>
512 <option value='0' id='redundant_setup_0' SELECTED>No
513 <option value='1' id='redundant_setup_1' >Yes
514 </select></td>
515 </tr>
516
517 <tr><td class='ItemName'><font color='red'>*</font>Number of Director (Running bacula-dir):</td>
518 <td class='ItemValue'>
519 <input type='text' class='ItemValue' id='number_dir' name='number_dir' 
520  size='5' maxlength='10' value=''></td>
521 </tr>
522
523 <tr><td class='ItemName'><font color='red'>*</font>Number of Clients (Running bacula-fd):</td>
524 <td class='ItemValue'>
525 <input type='text' class='ItemValue' id='number_fd' name='number_fd' 
526  size='5' maxlength='10' value=''></td>
527 </tr>
528
529 <tr><td class='ItemName'>
530 <font color='red'>*</font>Number of Storage Daemons (Running bacula-sd):</td>
531 <td class='ItemValue'>
532 <input type='text' class='ItemValue' id='number_sd' name='number_sd' size='5' 
533  maxlength='10' value=''></td>
534 </tr>
535
536 <tr><td class='ItemName' title="See bellow how to get this information"><font color='red'>*</font>Total # of GB saved every month:</td>
537 <td class='ItemValue'><input type='text' class='ItemValue' name='month_gb' size='5' 
538  id='month_gb' maxlength='10' value=''></td>
539 </tr>
540
541 <tr><td class='ItemName' title='See bellow how to get this information'><font color='red'>*</font>Number # of Files:</td>
542 <td class='ItemValue'><input type='text' class='ItemValue' name='number_files'
543  id='number_files' size='10' maxlength='15' value=''></td>
544 </tr>
545 <tr>
546
547 <td class='ItemName'>Need professional support:</td>
548 <td class='ItemValue'>
549 <select name='support' class='ItemValue'>
550 <option id='support_0' value='0' SELECTED>No
551 <option id='support_1' value='1'>Yes
552 </select></td>
553 </tr>
554
555 <tr><td colspan=4><br></td></tr>
556
557 <tr><td class='ItemName' valign='top'>Applicable Hardware and Network Information:</td>
558 <td class='ItemValue' colspan='3'>
559 <textarea name='hardware_comments' wrap='virtual' rows='4' id='hardware_comments'
560  cols='60' class='ItemValue'>Loader Description:
561 Barcode Reader: Yes/No
562 Number of Storage Elements:
563 Number of Import/Export Elements:
564 --
565 Nics: 
566 ...
567 </textarea>
568 </tr>
569
570 <tr><td class='ItemName' valign='top'>General Comments:</td>
571 <td class='ItemValue' colspan='3'>
572 <textarea name='comments' id='comments' wrap='virtual' rows='4' cols='60' 
573  class='ItemValue'></textarea></tr>
574
575 <tr><td></td><td>
576 <?
577  if ($_REQUEST['action'] == 'Modify') {
578   echo "<input type='hidden' title='testimonial id' id='id' name='id' class='ItemValue' value=''>";
579   echo "<input type='submit' name='action' class='ItemValue' onclick='return validate_testimonial();' value='Save'>";
580   echo "<input type='submit' name='action' class='ItemValue' onclick='confirm(\"Are you sure ?\");' value='Delete'><br>";
581   echo "<input type='hidden' name='page' class='ItemValue' value='testimonial'><br>";
582
583 } else {  
584   echo "<input type='submit' name='action' class='ItemValue' onclick='return validate_testimonial(this);' value='Review Profile Submission'>";
585 }
586 ?>
587
588 </td></tr>
589 </table>
590 </form>
591
592 </td>
593 </tr>
594 <tr>
595
596         <td class="content">
597         <h3 style="padding: 5px; border-bottom: 1px dotted #002244"> Getting backup information </h3>
598 To get <i>Total # of GB saved every month</i>, you can run this query on you catalog (just adapt the starttime condition and round the result)
599 <pre>
600 bacula@yourdir:~$ bconsole
601 *sql
602 SELECT sum(JobBytes)/1073741824 FROM Job WHERE StartTime > '2008-02-07' AND Type = 'B'
603 </pre>
604
605 To know how many files are in your catalog, you can run this:
606 <pre>
607 bacula@yourdir:~$ bconsole
608 *sql
609 SELECT sum(JobFiles) FROM Job WHERE Type = 'B'
610 </pre>
611         </td>
612 </tr>
613 <tr>
614         <td class="content">
615         <h3 style="padding: 5px; border-bottom: 1px dotted #002244"> Privacy Notice </h3>
616
617 The following information is required, but you may choose to not have it
618 published for public viewing if you wish: contact name, email address,
619 organization name. We may use this information to verify the data you submit if
620 we find the need.
621         </td>
622 </tr>
623
624
625 </table>
626 <?
627 }
628 if ($_REQUEST['action'] == 'Modify') {
629    $filename = get_file_from_id();
630
631    if (!$filename) {
632         return (0);
633    }
634
635    $formul = load_formul($filename);
636
637    echo "<script type='text/javascript' language='JavaScript'>\n";
638    $attribs = array('contact_name','email_address', 'org_name','title','website',
639                     'month_gb','number_files', 'number_dir','number_fd','number_sd',
640                     'org_size','id');
641    foreach ($attribs as $arr) {
642            form_set_value($formul, $arr);
643    }
644
645    $attribs = array('publish_contact','publish_email', 'publish_orgname', 'orgtype_id', 
646                     'orgindustry_id', 'publish_orgsize','publish_website', 'bacula_version',
647                     'country_id','ostype_id', 'redundant_setup', 'catalog_id', 'support');
648    foreach ($attribs as $arr) {
649         form_set_selection($formul, $arr);
650    }
651
652    $attribs = array('comments', 'hardware_comments');
653    foreach ($attribs as $arr) {
654         form_set_text($formul, $arr);
655    }
656   
657
658    echo "</script>\n";
659
660 } elseif ($_REQUEST['action'] == 'Review Profile Submission') {
661
662         $form = get_formul();
663         if (!$form) {
664                 echo "Sorry, something is missing, I can't accept your submission";
665         } else {
666                 $token = uniqid(md5(rand()), true);
667                 $filename = "$dat_dir/profile.$token";
668         
669                 $form['filename'] = $filename;  
670                 $form['id'] = $token;
671                 $form['visible']=0;
672                 save_formul($form);
673
674                 send_email($form['id'], $form['contact_name'], $form['email_address']);
675                 echo "You can modify your profile <a href='?page=testimonial&action=Modify&id=" . $form['id'] . "'>here</a> (keep this link as bookmark)<br><br>";
676                 print_formul($form);
677         }
678
679 } elseif ($_REQUEST['action'] == 'View') {
680         
681         $file = get_file_from_id();
682
683         if ($file) {
684              print_formul_file($filename,true);
685         }
686
687 } elseif ($_REQUEST['action'] == 'Delete') {
688
689         $filename = get_file_from_id();
690
691         if (!$filename) {
692             return (0);
693         }
694
695         $form = load_formul($filename);
696         
697         if ($form['org_logo'] && file_exists($form['org_logo'])) {
698             rename($upload_dir + $form['org_logo'], 'removed.' + $upload_dir + $form['org_logo']);
699         }
700         if (file_exists($filename)) {
701             rename($filename, "$filename-removed");
702             echo "Profile deleted";
703         }
704
705 } elseif ($_REQUEST['action'] == 'Accept' && is_admin()) {
706
707         $filename = get_file_from_id();
708         
709         if (!$filename) {
710             return (0);
711         }
712
713         $form = load_formul($filename);
714
715         $hide = $_REQUEST['hide'];
716
717         if ($hide) {
718                 $form['visible']=0;
719         } else {
720                 $form['visible']=1;
721         }
722         save_formul($form);
723         echo $form['id'] . " is now " . ($hide?"un":"") . "visible";
724         print_formul($form);
725
726 } elseif ($_REQUEST['action'] == 'Save') {
727         
728         $filename = get_file_from_id();
729
730         if (!$filename) {
731             return (0);
732         }
733
734         $form = get_formul();
735
736         $form['filename'] = $filename;  
737         $form['id'] = $_REQUEST['id'];  // id is clean
738 //      $form['visible'] = false;
739
740         if (!$form['org_logo']) {
741             $form_old = load_formul($filename);
742             $form['org_logo'] = $form_old['org_logo'];
743         }
744
745         save_formul($form);
746
747         echo "Your profile has been modified.<br>";
748         print_formul($form);
749
750 } elseif ($_REQUEST['action'] == 'Admin' && is_admin()) {
751
752     view_all();
753
754 } elseif (!$_REQUEST['action'] || $_REQUEST['action'] == 'ViewAll') {
755
756     echo "<a href='?page=testimonial&action=Add'>Add your testimonial</a><br><br>";
757     view_all();
758
759 } elseif ($_REQUEST['action'] == 'AdminExport' && is_admin()) {
760
761    $file = get_file_from_id();
762    if (!$file) {
763        return 0;
764    }
765    $form = load_formul($file);
766    if ($form) {
767         export_form($form);
768    }
769 } elseif ($_REQUEST['action'] == 'sql') {
770    print "<pre>";
771    dump_sql();
772    print "</pre>";
773 }
774
775 function view_all()
776 {
777     global $dat_dir;
778     global $password;
779
780     $limit = $_REQUEST['limit'];
781     $offset = $_REQUEST['offset'];
782
783     $limit = is_numeric($limit)?$limit:5;
784     $offset = is_numeric($offset)?$offset:0;
785     $max = $offset + $limit;
786
787     $admin = is_admin();
788     if ($limit > 20) { $limit = 20 ;}
789
790     if ($handle = opendir($dat_dir)) {
791     /* Ceci est la facon correcte de traverser un dossier. */
792         $i = 0 ;
793         while (false !== ($file = readdir($handle))) {
794             if (preg_match("/^profile.[a-z0-9\.]+$/", $file)) {
795                 if (($i >= $offset) && ($i < $max)) {
796                     $i += print_formul_file("$dat_dir/$file",$admin);
797                 } else {
798                     $i++;
799                 }
800                 if ($i > $max) {
801                     break;
802                 }
803             }
804         } 
805         closedir($handle);
806     }
807     if ($offset > 0) {
808        $offset = $offset - $limit;
809        if ($offset < 0) {
810           $offset=0;
811        }
812        echo "<a href='?page=testimonial&offset=$offset&limit=$limit$password'>Prev</a>&nbsp;";
813     }
814     if ($i >= $max) {
815        $offset = $offset + $limit;
816        echo "&nbsp;<a href='?page=testimonial&offset=$offset&limit=$limit$password'>Next</a><br>";
817     }
818 }
819
820 function export_form($formul)
821 {
822         global $country_lst, $org_type_lst, $org_industry_lst, $os_lst, $catalog_lst, $version_lst;
823
824         $attribs = array('contact_name','email_address', 'org_name','title','website',
825                          'hardware_comments','comments',
826                          'publish_contact','publish_email', 'publish_orgname','org_size','redundant_setup',
827                          'date','visible', 'support','number_dir',
828                          'number_fd','number_sd','month_gb','number_files','publish_orgsize','publish_website');
829         print "<pre>\n";
830         foreach ($attribs as $arr) {
831                 print "$arr = " . $formul[$arr] . "\n";
832         }
833
834         print "orgtype = " . $org_type_lst[$formul['orgtype_id']] . "\n";
835         print "orgindustry = " . $org_industry_lst[$formul['orgindustry_id']] . "\n";
836         print "bacula_version = " . $version_lst[$formul['bacula_version']] . "\n";
837         print "country = " . $country_lst[$formul['country_id']] . "\n";
838         print "ostype = " . $os_lst[$formul['ostype_id']] . "\n";
839         print "catalog = " . $catalog_lst[$formul['catalog_id']] . "\n";
840
841         print "<pre>\n";
842 }
843
844 function get_file_from_id()
845 {
846     global $dat_dir;
847     $id = $_REQUEST['id'];
848
849     if (!ereg('^[a-zA-Z0-9\.]+$',$id)) {
850          return(0) ;
851     }
852
853     $filename="$dat_dir/profile.$id";
854
855     if (!file_exists($filename)) {
856          echo "Can't verify your id";
857          return (0);
858     }       
859
860     return $filename;
861 }
862
863 function send_email($id, $name, $email)
864 {
865         // Your email address
866 //        $from = 'kern@sibbald.com';
867         $from = 'eric@eb.homelinux.org';
868
869         // The subject
870         $subject = "[BACULA] New testimonial";
871
872         // The message
873         $message = "Hello, 
874 You can modify your new testimonial at http://www.bacula.org/en/?page=testimonial&action=Modify&id=$id
875
876 Best regards.
877 ";
878
879         mail($email, $subject, $message, "From: Bacula WebMaster <$from>");
880
881         $message = "Hello, 
882 You can review this testimonial at http://www.bacula.org/en/?page=testimonial&action=Modify&id=$id
883
884 Best regards.
885 ";
886
887         
888         mail('testimonial@baculasystems.com', $subject, $message, "From: $name <$email>");
889
890         echo "The email has been sent for approval.<br/>";
891 }
892
893 function save_formul($form)
894 {
895         $fp = fopen($form['filename'], 'w'); 
896         fwrite($fp, serialize($form));
897         fclose($fp);
898 }
899
900 function get_formul()
901 {
902         global $upload_dir;
903         global $dat_dir;
904         $formul = array();
905         $attribs = array('contact_name','email_address', 'org_name');
906         foreach ($attribs as $arr) {
907                 if (!$_REQUEST[$arr]) {
908                         echo "Can't get $arr<br/>";
909                         return '';
910                 }
911                 $formul[$arr] = preg_replace('/[^a-zA-Z0-9!\.?\:\/,;_()@\n -]/', " ", $_REQUEST[$arr]);
912         }
913
914         $attribs = array('title','website','hardware_comments','comments')              ;
915         foreach ($attribs as $arr) {
916                 $formul[$arr] = preg_replace('/[^a-zA-Z0-9!\.?\:\/,;_()@\n -]/', " ", $_REQUEST[$arr]);
917         }
918         /* Disallow http:// links into comments field */
919         $m = array();
920         preg_match('/http:\/\//', $_REQUEST['comments'], $m);
921         if (sizeof($m) > 2) {
922            return '';
923         }
924         $m = array();
925         preg_match('/http:\/\//', $_REQUEST['hardware_comments'], $m);
926         if (sizeof($m) > 2) {
927            return '';
928         }
929         /* Disallow when number of dir too big or > number of fd */
930         if (intval($_REQUEST['number_dir']) > 100 || 
931             intval($_REQUEST['number_dir']) > intval($_REQUEST['number_fd'])) {
932            return '';
933         }
934         $attribs = array('publish_contact','publish_email', 'publish_orgname', 'orgtype_id', 
935                          'orgindustry_id','org_size', 'publish_orgsize','publish_website', 'bacula_version',
936                          'country_id','ostype_id', 'redundant_setup','number_fd','number_sd','support',
937                          'month_gb','number_files','catalog_id','number_dir');
938         foreach ($attribs as $arr) {
939                 $tmp = $_REQUEST[$arr];
940                 $tmp = preg_replace("/[,\.]/", "", $tmp);
941                 if (preg_match("/^[0-9]+$/", $tmp)) {
942                         $formul[$arr] = $_REQUEST[$arr];
943                 }
944         }
945
946         $attribs = array('orgtype_id', 'orgindustry_id', 'org_size', 'country_id','bacula_version',
947                          'catalog_id', 'ostype_id','number_fd','number_sd', 'number_dir', 'month_gb','number_files');
948         foreach ($attribs as $arr) {
949                 if (!$formul[$arr]) {
950                         echo "Can't get $arr<br/>";
951                         return '';
952                 }
953         }
954
955         if ($_FILES['org_logo']) {
956                 $token = uniqid(md5(rand()), true);
957                 $image = "/upload/$token";
958
959                 if (preg_match("/(jpg|jpeg)$/i", $_FILES['org_logo']['name'])) {
960                         $image = "$image.jpg";
961                 } elseif (preg_match("/png$/i", $_FILES['org_logo']['name'])) {
962                         $image = "$image.png";
963                 } elseif (preg_match("/gif$/i", $_FILES['org_logo']['name'])) {
964                         $image = "$image.gif";
965                 } else {
966                         $image = '';
967                 }
968                 if ($image) {
969                         $ret=move_uploaded_file($_FILES['org_logo']['tmp_name'], "$upload_dir/$image");
970                         $formul['org_logo'] = $image;
971                 }
972         }
973         $formul['date'] = time();
974         $formul['visible'] = false;
975
976         return $formul;
977 }
978
979 function form_set_value($formul,$val)
980 {
981  echo "document.getElementById('$val').value = '" . $formul[$val] . "';\n";
982 }
983
984 function form_set_selection($formul,$val)
985 {
986  echo "document.getElementById('${val}_" . $formul[$val] . "').selected =true;\n";
987 }
988
989 function form_set_text($formul,$val)
990 {
991  $temp = $formul[$val];
992  $temp = str_replace(array("\n", "\r"), array("\\n",""), $temp);
993  echo "document.getElementById('$val').value='" . $temp . "';\n";
994 }
995
996 // passwd file must exist in dat directory
997 function is_admin()
998 {
999    global $dat_dir;
1000    $id = $_REQUEST['p'];
1001
1002    if (!$id) {
1003        return(false);
1004    }
1005
1006    if (!ereg('^[a-zA-Z]+$',$id)) {
1007        return(false) ;
1008    }
1009    
1010    if (file_exists("$dat_dir/$id")) {
1011        return true;
1012    } else {
1013        return false;
1014    }
1015 }
1016
1017 function admin_link()
1018 {
1019    global $password;
1020    if (is_admin()) {
1021       $pass = $_REQUEST['p'];
1022       $waiting = $_REQUEST['waiting'];    
1023       $password = "&p=$pass";
1024       print "Admin: ";
1025       if ($waiting) {
1026          print "<a href='?page=testimonial&action=Admin$password'> View all</a><br>";
1027       } else {
1028          print "<a href='?page=testimonial&action=Admin$password'> View all</a> | ";
1029          print "<a href='?page=testimonial&action=Admin&waiting=1$password'> View Waiting</a><br>";
1030       }
1031            print "<hr>";
1032    }
1033 }
1034
1035 function load_formul($filename)
1036 {
1037    if (!file_exists($filename)) {
1038            return array();
1039    }
1040
1041    if (!filesize($filename) || filesize($filename) > 10*1024*1024) {
1042        return undef;
1043    }
1044    $fp = fopen($filename, 'r');
1045    $contents = fread ($fp, filesize ($filename));
1046    fclose ($fp);
1047
1048    $formul = unserialize($contents);
1049    if (!is_array($formul)) {
1050        return undef;
1051    }
1052
1053    return $formul;
1054 }
1055
1056 function print_formul_file($filename, $admin) {
1057     global $password;
1058     $form = load_formul($filename);
1059     if (!$form) {
1060        return 0;
1061     }
1062     
1063     if (!$admin) {
1064        if (!$form['visible']) {
1065           return 0;
1066        }
1067     } 
1068     $waiting = $_REQUEST['waiting'];
1069     if ($admin && $waiting && $form['visible']) {
1070        return 0;
1071     }
1072
1073     $ret = print_formul($form);
1074     if ($admin) {
1075        if ($form['visible']) {
1076           print "<a href=\"?page=testimonial&action=Accept&hide=1$password&id=" . $form['id'] . "\"> Hide </a> | \n";
1077        } else {
1078           print "<a href=\"?page=testimonial&action=Accept$password&id=" . $form['id'] . "\"> Accept </a> | \n";
1079        }
1080        print "<a href=\"?page=testimonial&action=Modify$password&id=" . $form['id'] . "\"> Modify </a> | \n";
1081        print "<a href=\"?page=testimonial&action=AdminExport$password&id=" . $form['id'] . "\"> Export </a><br><br>\n";
1082    }
1083    return $ret;
1084 }
1085
1086 function dump_sql()
1087 {
1088    global $dat_dir, $country_lst, $org_type_lst, $org_industry_lst, $os_lst,$catalog_lst, $version_lst;
1089    if (!is_admin()) {
1090      return;
1091    }
1092 ?>
1093    CREATE TABLE dict (lang text, id int, name text, primary key (lang, id));
1094    CREATE TABLE testimonials (
1095     contact_name        text,
1096     email_address       text,
1097     org_name            text,
1098     title               text  DEFAULT '',
1099     website             text  DEFAULT '',
1100     filename            text  DEFAULT '',
1101     month_gb            int   DEFAULT 0,
1102     number_files        bigint DEFAULT 0,
1103     number_dir          int   DEFAULT 0,
1104     number_fd           int   DEFAULT 0,
1105     number_sd           int   DEFAULT 0,
1106     org_size            int   DEFAULT 0,
1107
1108     country_id          int,
1109     ostype_id           int,
1110     bacula_version      int,
1111     contry_id           int,
1112     orgindustry_id      int,
1113     orgtype_id          int,
1114     catalog_id          int,
1115
1116     id                  text,
1117     publish_contact     int    DEFAULT 0,
1118     publish_email       int    DEFAULT 0,
1119     publish_website     int    DEFAULT 0,
1120     publish_orgname     int    DEFAULT 0,
1121     publish_orgsize     int    DEFAULT 0,
1122     redundant_setup     int    DEFAULT 0,
1123     support             int    DEFAULT 0,
1124     comments            text   DEFAULT '',
1125     hardware_comments   text   DEFAULT '', 
1126     visible             int    DEFAULT 0,
1127     org_logo            text   DEFAULT '',
1128     date                int    DEFAULT 0,
1129     lastmodifed         int    DEFAULT 0
1130    );
1131
1132    CREATE VIEW reference AS SELECT contact_name,email_address,org_name,title,website,hardware_comments,comments,
1133           publish_contact,publish_email,publish_orgname,org_size,publish_orgsize,publish_website,
1134           redundant_setup,number_fd,number_sd,support,month_gb,number_files,number_dir,date,visible,filename,t.id,
1135           orgtype.name AS orgtype, 
1136           orgindustry.name AS orgindustry,
1137           version.name AS bacula_version,
1138           country.name AS country,
1139           ostype.name AS ostype,
1140           catalog.name AS catalog
1141    FROM testimonials AS t, dict AS  orgtype, dict AS orgindustry, dict AS version, dict AS country, dict AS ostype,
1142         dict AS catalog
1143
1144    WHERE t.orgtype_id = orgtype.id            AND orgtype.lang     = 'en'
1145      AND t.orgindustry_id = orgindustry.id    AND orgindustry.lang = 'en'
1146      AND t.bacula_version = version.id AND version.lang = 'en'
1147      AND t.country_id = country.id            AND country.lang = 'en'
1148      AND t.ostype_id  = ostype.id             AND ostype.lang = 'en'
1149      AND t.catalog_id = catalog.id            AND catalog.lang = 'en';
1150
1151
1152    INSERT INTO dict (lang, id, name) VALUES ('en', 0, 'no');
1153    INSERT INTO dict (lang, id, name) VALUES ('en', 1, 'yes');
1154 <?
1155    $a = array($version_lst, $country_lst, $org_type_lst, $org_industry_lst, $os_lst,$catalog_lst);
1156    foreach ($a as $tab) {
1157       while(list ($key, $val) = each ($tab))
1158       {   
1159           if ($key != 'empty') {
1160              echo "INSERT INTO dict (lang, id, name) VALUES ('en', $key, '$val');\n";
1161           }
1162       }
1163    }
1164     if ($handle = opendir($dat_dir)) {
1165     /* Ceci est la facon correcte de traverser un dossier. */
1166         while (false !== ($file = readdir($handle))) {
1167             if (preg_match("/^profile.[a-z0-9\.]+$/", $file)) {
1168                $tmpv = array();
1169                $tmpk = array();
1170                $form = load_formul("$dat_dir/$file");
1171                while(list ($key, $val) = each ($form))
1172                {
1173                    array_push($tmpv, "'$val'");
1174                    array_push($tmpk, $key);
1175                }
1176                echo "INSERT INTO testimonials (";
1177                print join(",", $tmpk);
1178                echo ") VALUES (";
1179                print join(",", $tmpv);
1180                echo ");\n";               
1181             }
1182         } 
1183         closedir($handle);
1184     }
1185 }
1186
1187 function print_formul($formul)
1188 {
1189    global $country_lst, $org_type_lst, $org_industry_lst, $os_lst,$catalog_lst;
1190
1191    ?>
1192    <table width="80%">
1193    <td>
1194    <b><? echo ($formul['publish_orgname'])?$formul['org_name']:'N/A' ?></b><br>
1195    <table>
1196    <tr><td> Date: </td><td><? echo date('d/m/o', $formul['date']) ?> </td></tr>
1197    <tr><td> Location: </td><td><? $a = $formul['country_id'] ; echo $country_lst[$a] ?> </td></tr>
1198    <tr><td> Organization Type: </td><td><? echo $org_type_lst[$formul['orgtype_id']] ?> </td></tr>
1199    <tr><td> Industry/Function: </td><td><? echo $org_industry_lst[$formul['orgindustry_id']] ?> </td></tr>
1200
1201    <? if ($formul['publish_orgsize']) { ?>
1202         <tr><td> Organisation Size: </td><td><? echo $formul['org_size'] ?> </td></tr>
1203    <? } ?>
1204
1205    <? if ($formul['publish_website']) { ?>
1206         <tr><td> Website: </td><td><a href="<? echo $formul['website'] ?>"><? echo $formul['website'] ?></a></td></tr>
1207    <? } ?>
1208
1209    <? if ($formul['number_fd'] > 1) { ?>
1210         <tr><td> Number of fd: </td><td><? echo $formul['number_fd'] ?> </td></tr>
1211    <? } ?>
1212
1213    <? if ($formul['month_gb'] > 1) { ?>
1214         <tr><td> GB/Month: </td><td><? echo $formul['month_gb'] ?> </td></tr>
1215    <? } ?>
1216
1217    <tr><td> Comments: </td><td width='650'><i><? echo $formul['comments'] ?> </i></td></tr>
1218    <? if ($formul['publish_contact']) { ?>
1219         <tr align='right'><td></td><td><i><? echo $formul['contact_name'] ?> </i></td></tr>
1220    <? } ?>
1221 <!--
1222    </table>
1223    </td>
1224 -->
1225    <tr><td></td>
1226    <td>
1227    <? if ($formul['org_logo']) { ?>
1228         <a href="<? echo $formul['org_logo'] ?>" ><img width='150' src="<? echo $formul['org_logo'] ?>"></a>
1229    <? } ?>
1230    </td>
1231    </tr> <!-- added -->
1232    </table>
1233 <?
1234    return 1;
1235 }
1236
1237 ?>
1238 <? require_once("inc/footer.php"); ?>