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