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