]> git.sur5r.net Git - bacula/docs/blob - docs/home-page/pages/testimonial.php
Update
[bacula/docs] / docs / home-page / pages / testimonial.php
1 <? require_once("inc/header.php"); ?>
2 <?
3 $dat_dir = '../testimonials';
4
5 $org_type_lst = array(
6        '0'   => "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        '0'   => "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        '0'   => "SELECT ONE",
28        '1'   => "MySQL",
29        '2'   => "PostgreSQL",
30        '3'   => "SqLite"
31 );
32
33 $org_industry_lst = array(
34    '0'   => '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    '0'  =>  '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    '0'   =>  '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['btnSubmit'] == 'Add' or $_REQUEST['btnSubmit'] == 'Modify')
197 {
198
199 ?>
200 <table>
201 <tr>
202         <td class="contentTopic">
203                 <? echo $_REQUEST['btnSubmit'] ?> Testimonial
204         </td>
205 </tr>
206 <tr>
207         <td class="content">
208
209 Want to let others know you're using Bacula? Submit a user profile!  Your
210 submission will be reviewed before being made publicly available.  We reserve
211 the right to edit your submission for spelling, grammar, etc. You will receive
212 an email when your profile has been approved for public viewing. Note that
213 while your contact name and email address are required (to verify
214 information if necessary), you can choose to have them not be published along
215 with your profile information.  
216 <br/><br/>
217 Fields marked with a * are required. Read the privacy notice below for
218 information about how this data will be used.
219
220         </td>
221 </tr>
222
223 <tr>
224         <td class="content">
225 <form enctype="multipart/form-data" method='post' action='?page=testimonial'>
226 <input type='hidden' name='page' value='testimonial'>
227 <table border='0' class='Content'>
228
229 <td class='ItemName'>
230 <font color='red'>*</font>Contact Name:</td>
231 <td class='ItemValue'><input type='text' class='ItemValue' id='contact_name' 
232 name='contact_name' size='30' maxlength='100' value=''></td>
233 <td class='ItemName'>Publish Contact Name?</td>
234 <td class='ItemValue'><select name='publish_contact' class='ItemValue'>
235 <option id='publish_contact_0'  value='0' SELECTED>No
236 <option id='publish_contact_1' value='1'>Yes
237 </select></td>
238 </tr>
239
240 <tr>
241 <td class='ItemName'><font color='red'>*</font>Email Address:</td>
242 <td class='ItemValue'><input type='text' class='ItemValue' name='email_address' 
243 id='email_address' size='30' maxlength='150' value=''></td>
244 <td class='ItemName'>Publish Email Address?</td><td class='ItemValue'>
245 <select name='publish_email' class='ItemValue'>
246 <option value='0' id='publish_email_0' SELECTED>No
247 <option value='1' id='publish_email_1' >Yes
248 </select></td>
249 </tr>
250
251 <tr><td class='ItemName'>Job Description/Title:</td>
252 <td class='ItemValue'>
253 <input type='text' name='title' id='title' size='30' maxlength='100' value=''></td></tr>
254 <tr><td colspan=4><br></td></tr>
255
256 <tr><td class='ItemName'><font color='red'>*</font>Organization Name:</td>
257 <td class='ItemValue'>
258 <input type='text' class='ItemValue' name='org_name' id='org_name' 
259 size='30' maxlength='100' value=''>
260 </td><td class='ItemName'>Publish Org Name?</td><td class='ItemValue'>
261 <select name='publish_orgname' class='ItemValue'>
262 <option value='0' id='publish_orgname_0' >No
263 <option value='1' id='publish_orgname_1' SELECTED>Yes
264 </select></td>
265 </tr>
266
267 <tr><td class='ItemName'><font color='red'>*</font>Organization Type:</td>
268 <td class='ItemValue' colspan='3'>
269 <select name='orgtype_id' class='ItemValue'>
270 <?
271
272 while(list ($key, $val) = each ($org_type_lst))
273 {
274  echo "<option id='orgtype_id_$key' value='$key'>$val\n";
275 }
276
277 ?>
278 </select>
279 </td></tr>
280
281 <tr><td class='ItemName'><font color='red'>*</font>Organization Industry/Function:</td>
282 <td class='ItemValue' colspan='3'>
283 <select name='orgindustry_id' class='ItemValue'>
284 <?
285
286 while(list ($key, $val) = each ($org_industry_lst))
287 {
288  echo "<option id='orgindustry_id_$key' value='$key'>$val\n";
289 }
290
291 ?>
292 </select>
293 </td></tr>
294
295 <tr><td class='ItemName'>
296 <font color='red'>*</font>Approx. Organization Size (# of Users):</td>
297 <td class='ItemValue'>
298 <input type='text' id='org_size' class='ItemValue' name='org_size' 
299 size='4' maxlength='6' value=''></td>
300 <td class='ItemName'>Publish Org Size?</td><td class='ItemValue'><select name='publish_orgsize' class='ItemValue'>
301 <option id='publish_orgsize_0' value='0' >No
302 <option id='publish_orgsize_1' value='1' SELECTED>Yes
303 </select></td>
304 </tr>
305 <tr>
306
307 <td class='ItemName'>Website URL:</td>
308 <td class='ItemValue'>
309 <input type='text' class='ItemValue' id='website' name='website' size='30'
310  maxlength='150' value=''></td>
311 <td class='ItemName'>Publish Website?</td><td class='ItemValue'>
312 <select name='publish_website' class='ItemValue'>
313 <option id='publish_website_0' value='0' >No
314 <option id='publish_website_1' value='1' SELECTED>Yes
315 </select></td>
316 </tr>
317
318 <tr>
319 <td class='ItemName'>Organization Logo :</td>
320 <td class='ItemValue'>
321 <input type="file" name="org_logo" title="png, gif or jpeg file only please"/>
322 </td><td><i>max width 150px. png, gif or jpeg only</i></td>
323 </tr>
324
325 <tr><td class='ItemName'><font color='red'>*</font>Country:</td>
326 <td class='ItemValue'>
327 <select name='country_id' class='ItemValue'>
328 <?
329 while(list ($key, $val) = each ($country_lst))
330 {
331  echo "<option id='country_id_$key' value='$key'>$val\n";
332 }
333
334 ?>
335 </select>
336 </td></tr>
337
338 <tr><td colspan=4><br></td></tr>
339 <tr><td class='ItemName'><font color='red'>*</font>Bacula version:</td>
340 <td class='ItemValue'>
341 <select name='bacula_version' class='ItemValue'>
342 <?
343
344 while(list ($key, $val) = each ($version_lst))
345 {
346  echo "<option id='bacula_version_$key' value='$key'>$val\n";
347 }
348
349 ?>
350 </select>
351 </td></tr>
352 <tr><td class='ItemName'><font color='red'>*</font>Director OS:</td>
353 <td class='ItemValue'>
354 <select name='ostype_id' class='ItemValue'>
355 <?
356
357 while(list ($key, $val) = each ($os_lst))
358 {
359  echo "<option id='ostype_id_$key' value='$key'>$val\n";
360 }
361
362 ?>
363 </select>
364 </td></tr>
365 <tr><td class='ItemName'><font color='red'>*</font>Catalog DB:</td>
366 <td class='ItemValue'>
367 <select name='catalog_id' class='ItemValue'>
368 <?
369
370 while(list ($key, $val) = each ($catalog_lst))
371 {
372  echo "<option id='catalog_id_$key' value='$key'>$val\n";
373 }
374
375 ?>
376 </select>
377 </td></tr>
378 <tr>
379 <td class='ItemName'><font color='red'>*</font>Redundant/Failover Backup Setup?</td>
380 <td class='ItemValue'><select name='redundant_setup' class='ItemValue'>
381 <option value='0' id='redundant_setup_0' SELECTED>No
382 <option value='1' id='redundant_setup_1' >Yes
383 </select></td>
384 </tr>
385
386 <tr><td class='ItemName'><font color='red'>*</font>Number of Clients (Running bacula-fd):</td>
387 <td class='ItemValue'>
388 <input type='text' class='ItemValue' id='number_fd' name='number_fd' 
389  size='5' maxlength='10' value=''></td>
390 </tr>
391
392 <tr><td class='ItemName'>
393 <font color='red'>*</font>Number of Storage Daemons (Running bacula-sd):</td>
394 <td class='ItemValue'>
395 <input type='text' class='ItemValue' id='number_sd' name='number_sd' size='5' 
396  maxlength='10' value=''></td>
397 </tr>
398
399 <tr><td class='ItemName'><font color='red'>*</font>Total # of GB saved every month:</td>
400 <td class='ItemValue'><input type='text' class='ItemValue' name='month_gb' size='5' 
401  id='month_gb' maxlength='10' value=''></td>
402 </tr>
403
404 <tr><td class='ItemName'><font color='red'>*</font>Number # of Files:</td>
405 <td class='ItemValue'><input type='text' class='ItemValue' name='number_files'
406  id='number_files' title='select count(1) from File;' size='10' maxlength='15' value=''></td>
407 </tr>
408 <tr>
409
410 <td class='ItemName'>Need professional support:</td>
411 <td class='ItemValue'>
412 <select name='support' class='ItemValue'>
413 <option id='support_0' value='0' SELECTED>No
414 <option id='support_1' value='1'>Yes
415 </select></td>
416 </tr>
417
418 <tr><td colspan=4><br></td></tr>
419
420 <tr><td class='ItemName' valign='top'>Applicable Hardware and Network Information:</td>
421 <td class='ItemValue' colspan='3'>
422 <textarea name='hardware_comments' wrap='virtual' rows='4' id='hardware_comments'
423  cols='60' class='ItemValue'>Loader Description:
424 Barcode Reader: Yes/No
425 Number of Storage Elements:
426 Number of Import/Export Elements:
427 --
428 Nics: 
429 ...
430 </textarea>
431 </tr>
432
433 <tr><td class='ItemName' valign='top'>General Comments:</td>
434 <td class='ItemValue' colspan='3'>
435 <textarea name='comments' id='comments' wrap='virtual' rows='4' cols='60' 
436  class='ItemValue'></textarea></tr>
437
438 <tr><td></td><td>
439 <?
440  if ($_REQUEST['btnSubmit'] == 'Modify') {
441   echo "<input type='text' title='testimonial id' id='id' name='id' class='ItemValue' value=''>";
442   echo "<input type='submit' name='btnSubmit' class='ItemValue' value='Save'>";
443   echo "<input type='submit' name='btnSubmit' class='ItemValue' onclick='confirm(\"Are you sure ?\");' value='Delete'><br>";
444   echo "<input type='hidden' name='page' class='ItemValue' value='testimonial'><br>";
445
446 } else {  
447   echo "<input type='submit' name='btnSubmit' class='ItemValue' value='Review Profile Submission'>";
448 }
449 ?>
450
451 </td></tr>
452 </table>
453 </form>
454
455 </td>
456 </tr>
457 <tr>
458
459         <td class="content">
460         <h3 style="padding: 5px; border-bottom: 1px dotted #002244"> Privacy Notice </h3>
461
462 The following information is required, but you may choose to not have it
463 published for public viewing if you wish: contact name, email address,
464 organization name. We may use this information to verify the data you submit if
465 we find the need.
466         </td>
467 </tr>
468
469
470 </table>
471 <?
472
473 }
474
475 if ($_REQUEST['btnSubmit'] == 'Modify') {
476    $filename = get_file_from_id();
477
478    if (!$filename) {
479         return (0);
480    }
481
482    $formul = load_formul($filename);
483
484    echo "<script type='text/javascript' language='JavaScript'>\n";
485    $attribs = array('contact_name','email_address', 'org_name','title','website',
486                     'month_gb','number_files', 'number_fd','number_sd',
487                     'org_size','comments', 'hardware_comments', 'id');
488    foreach ($attribs as $arr) {
489            form_set_value($formul, $arr);
490    }
491
492    $attribs = array('publish_contact','publish_email', 'publish_orgname', 'orgtype_id', 
493                     'orgindustry_id', 'publish_orgsize','publish_website', 'bacula_version',
494                     'country_id','ostype_id', 'redundant_setup', 'catalog_id', 'support');
495    foreach ($attribs as $arr) {
496         form_set_selection($formul, $arr);
497    }
498
499    echo "</script>\n";
500
501 } elseif ($_REQUEST['btnSubmit'] == 'Review Profile Submission') {
502
503         $form = get_formul();
504         if (!$form) {
505                 echo "Sorry, something is missing, I cannot accept your submission";
506         } else {
507                 $token = uniqid(md5(rand()), true);
508                 $filename = "$dat_dir/profile.$token";
509         
510                 $form['filename'] = $filename;  
511                 $form['id'] = $token;
512                 save_formul($form);
513
514                 send_email($form['id'], $form['email_address']);
515                 echo "You can modify your profile <a href='?page=testimonial&btnSubmit=Modify&id=" . $form['id'] . "'>here</a> (keep this link as bookmark)<br><br>";
516                 print_formul($form);
517         }
518
519 } elseif ($_REQUEST['btnSubmit'] == 'View') {
520         
521         $file = get_file_from_id();
522
523         if ($file) {
524              print_formul_file($filename,true);
525         }
526
527 } elseif ($_REQUEST['btnSubmit'] == 'Delete') {
528
529         $filename = get_file_from_id();
530
531         if (!$filename) {
532             return (0);
533         }
534
535         $form = load_formul($filename);
536         
537         if ($form['org_logo'] && file_exists($form['org_logo'])) {
538             unlink($form['org_logo']);
539         }
540         if (file_exists($filename)) {
541             unlink($filename);
542             echo "Profile deleted";
543         }
544
545 } elseif ($_REQUEST['btnSubmit'] == 'Accept' && is_admin()) {
546
547         $filename = get_file_from_id();
548         
549         if (!$filename) {
550             return (0);
551         }
552
553         $form = load_formul($filename);
554
555         $hide = $_REQUEST['hide'];
556
557         if ($hide) {
558                 $form['visible']=0;
559         } else {
560                 $form['visible']=1;
561         }
562         save_formul($form);
563         echo $form['id'] . " is now " . ($hide?"un":"") . "visible";
564         print_formul($form);
565
566 } elseif ($_REQUEST['btnSubmit'] == 'Save') {
567         
568         $filename = get_file_from_id();
569
570         if (!$filename) {
571             return (0);
572         }
573
574         $form = get_formul();
575
576         $form['filename'] = $filename;  
577         $form['id'] = $_REQUEST['id'];  // id is clean
578 //      $form['visible'] = false;
579
580         if (!$form['org_logo']) {
581             $form_old = load_formul($filename);
582             $form['org_logo'] = $form_old['org_logo'];
583         }
584
585         save_formul($form);
586
587         echo "Your profile has been modified.<br>";
588         print_formul($form);
589
590 } elseif ($_REQUEST['btnSubmit'] == 'Admin' && is_admin()) {
591
592
593     $pass = $_REQUEST['passwd']; // passwd is clean
594     $waiting = $_REQUEST['waiting'];
595     
596     if ($waiting) {
597        print '<a href="?page=testimonial&btnSubmit=Admin&passwd=' . $pass . '"> View all</a><br>';
598        print "<h1>View all waiting testimonials</h1>";
599     } else {
600        print '<a href="?page=testimonial&btnSubmit=Admin&waiting=1&passwd=' . $pass . '"> View Waiting</a><br>';
601        print "<h1>View all testimonials</h1>";
602     }
603
604     if ($handle = opendir($dat_dir)) {
605     /* Ceci est la facon correcte de traverser un dossier. */
606             while (false !== ($file = readdir($handle))) {
607                 if (preg_match("/profile.[a-z0-9\.]+/", $file)) {
608                      $form = load_formul("$dat_dir/$file") ;
609                         // on affiche ceux qui sont en attente ou bien tous
610                      if (!$waiting || !$form['visible']) {
611                         print_formul($form);
612                         if ($form['visible']) {
613                            print "<a href=\"?page=testimonial&btnSubmit=Accept&hide=1&passwd=" . $pass . "&id=" . $form['id'] . "\"> Hide </a> | \n";
614                         } else {
615                            print "<a href=\"?page=testimonial&btnSubmit=Accept&passwd=" . $pass . "&id=" . $form['id'] . "\"> Accept </a> | \n";
616                         }
617                         print "<a href=\"?page=testimonial&btnSubmit=Modify&id=" . $form['id'] . "\"> Modify </a> | \n";
618                         print "<a href=\"?page=testimonial&btnSubmit=AdminExport&passwd=" . $pass . "&id=" . $form['id'] . "\"> Export </a><br><br>\n";
619
620                      }
621                 }
622             } 
623             closedir($handle);
624     } 
625
626 } elseif (!$_REQUEST['btnSubmit'] || $_REQUEST['btnSubmit'] == 'ViewAll') {
627
628     $limit = $_REQUEST['limit'];
629     $offset = $_REQUEST['offset'];
630
631     $limit = is_int($limit)?$limit:10;
632     $offset = is_int($offset)?$limit:0;
633
634     $admin = is_admin();
635
636     if ($limit > 20) { $limit = 20 ;}
637
638     echo "<a href='?page=testimonial&btnSubmit=Add'>Add a testimonial</a><br><br>";
639
640     if ($handle = opendir($dat_dir)) {
641     /* Ceci est la facon correcte de traverser un dossier. */
642             $i = 0 ;
643             while (false !== ($file = readdir($handle))) {
644                 if (preg_match("/profile.[a-z0-9\.]+/", $file)) {
645                     if ($i >= $offset && $i < ($offset + $limit)) {
646                         $i += print_formul_file("$dat_dir/$file",$admin);
647                     }
648
649                     if ($i > ($offset + $limit)) {
650                         break;
651                     }
652                 }
653             } 
654             closedir($handle);
655     }
656
657 } elseif ($_REQUEST['btnSubmit'] == 'AdminExport' && is_admin()) {
658
659    $file = get_file_from_id();
660    if (!$file) {
661        return 0;
662    }
663    $form = load_formul($file);
664    if ($form) {
665         export_form($form);
666    }
667 } else {
668         print "Invalid btnSubmit<br>";
669 }
670
671 function export_form($formul)
672 {
673         global $country_lst, $org_type_lst, $org_industry_lst, $os_lst, $catalog_lst;
674
675         $attribs = array('contact_name','email_address', 'org_name','title','website',
676                          'hardware_comments','comments',
677                          'publish_contact','publish_email', 'publish_orgname','org_size','redundant_setup',
678                          'date','visible', 'support',
679                          'number_fd','number_sd','month_gb','number_files','publish_orgsize','publish_website');
680         print "<pre>\n";
681         foreach ($attribs as $arr) {
682                 print "$arr = " . $formul[$arr] . "\n";
683         }
684
685         print "orgtype = " . $org_type_lst[$formul['orgtype_id']] . "\n";
686         print "orgindustry = " . $org_industry_lst[$formul['orgindustry_id']] . "\n";
687         print "bacula_version = " . $version_lst[$formul['bacula_version']] . "\n";
688         print "country = " . $country_lst[$formul['country_id']] . "\n";
689         print "ostype = " . $os_lst[$formul['ostype_id']] . "\n";
690         print "catalog = " . $catalog_lst[$formul['catalog_id']] . "\n";
691
692         print "<pre>\n";
693 }
694
695 function get_file_from_id()
696 {
697     global $dat_dir;
698     $id = $_REQUEST['id'];
699
700     if (!ereg('^[a-zA-Z0-9\.]+$',$id)) {
701          return(0) ;
702     }
703
704     $filename="$dat_dir/profile.$id";
705
706     if (!file_exists($filename)) {
707          echo "Can't verify your id";
708          return (0);
709     }       
710
711     return $filename;
712 }
713
714 function send_email($id, $email)
715 {
716         // Your email address
717         $from = 'kern@sibbald.com';
718 //        $from = 'eric@eb.homelinux.org';
719
720         // The subject
721         $subject = "[BACULA] New testimonial";
722
723         // The message
724         $message = "Hello, 
725 You can modify your new testimonial at http://www.bacula.org/?page=testimonial&btnSubmit=Modify&id=$id
726
727 Best regards.
728 ";
729
730         mail($email, $subject, $message, "From: Bacula WebMaster <$from>");
731         mail($from, $subject, $message, "From: Bacula WebMaster <$from>");
732         mail('eric@eb.homelinux.org', $subject, $message, "From: Bacula WebMaster <$from>");
733
734         echo "The email has been sent for approval.<br/>";
735 }
736
737 function save_formul($form)
738 {
739         $fp = fopen($form['filename'], 'w'); 
740         fwrite($fp, serialize($form));
741         fclose($fp);
742 }
743
744 function get_formul()
745 {
746         global $dat_dir;
747         $formul = array();
748         $attribs = array('contact_name','email_address', 'org_name');
749         foreach ($attribs as $arr) {
750                 if (!$_REQUEST[$arr]) {
751                         echo "Can't get $arr<br/>";
752                         return '';
753                 }
754                 $formul[$arr] = preg_replace('/[^a-zA-Z0-9!\.?\:\/,;_()@\n -]/', " ", $_REQUEST[$arr]);
755         }
756
757         $attribs = array('title','website','hardware_comments','comments');
758         foreach ($attribs as $arr) {
759                 $formul[$arr] = preg_replace('/[^a-zA-Z0-9!\.?\:\/,;_()@ -]/', " ", $_REQUEST[$arr]);
760         }
761
762         $attribs = array('publish_contact','publish_email', 'publish_orgname', 'orgtype_id', 
763                          'orgindustry_id','org_size', 'publish_orgsize','publish_website', 'bacula_version',
764                          'country_id','ostype_id', 'redundant_setup','number_fd','number_sd','support',
765                          'month_gb','number_files','catalog_id');
766         foreach ($attribs as $arr) {
767                 if (preg_match("/^[0-9]+$/", $_REQUEST[$arr])) {
768                         $formul[$arr] = $_REQUEST[$arr];
769                 }
770         }
771
772         $attribs = array('orgtype_id', 'orgindustry_id', 'org_size', 'country_id','bacula_version',
773                          'catalog_id', 'ostype_id','number_fd','number_sd', 'month_gb','number_files');
774         foreach ($attribs as $arr) {
775                 if (!$formul[$arr]) {
776                         echo "Can't get $arr<br/>";
777                         return '';
778                 }
779         }
780
781         if ($_FILES['org_logo']) {
782                 $token = uniqid(md5(rand()), true);
783                 $image = "upload/$token";
784
785                 if (preg_match("/(jpg|jpeg)$/i", $_FILES['org_logo']['name'])) {
786                         $image = "$image.jpg";
787                 } elseif (preg_match("/png$/i", $_FILES['org_logo']['name'])) {
788                         $image = "$image.png";
789                 } elseif (preg_match("/gif$/i", $_FILES['org_logo']['name'])) {
790                         $image = "$image.gif";
791                 } else {
792                         $image = '';
793                 }
794                 if ($image) {
795                         $ret=move_uploaded_file($_FILES['org_logo']['tmp_name'], $image);
796                         $formul['org_logo'] = $image;
797                 }
798         }
799         $formul['date'] = time();
800         $formul['visible'] = false;
801
802         return $formul;
803 }
804
805 function form_set_value($formul,$val)
806 {
807  echo "document.getElementById('$val').value = '" . $formul[$val] . "';\n";
808 }
809
810 function form_set_selection($formul,$val)
811 {
812  echo "document.getElementById('${val}_" . $formul[$val] . "').selected =true;\n";
813 }
814
815 // passwd file must exist in dat directory
816 function is_admin()
817 {
818         global $dat_dir;
819         $id = $_REQUEST['passwd'];
820
821         if (!ereg('^[a-zA-Z]+$',$id)) {
822             return(false) ;
823         }
824         
825         if (file_exists("$dat_dir/$id")) {
826             return true;
827         } else {
828             return false;
829         }
830 }
831
832 function load_formul($filename)
833 {
834         if (!file_exists($filename)) {
835                 return array();
836         }
837
838         if (!filesize($filename) || filesize($filename) > 10*1024*1024) {
839             return undef;
840         }
841         $fp = fopen($filename, 'r');
842         $contents = fread ($fp, filesize ($filename));
843         fclose ($fp);
844
845         $formul = unserialize($contents);
846         if (!is_array($formul)) {
847             return undef;
848         }
849
850         return $formul;
851 }
852
853 function print_formul_file($filename, $admin) {
854
855         $formul = load_formul($filename);
856         if (!$formul) {
857                 return 0;
858         }
859         
860         if (!$admin) {
861                 if (!$formul['visible']) {
862                         return 0;
863                 }
864         } else {
865                 print "<a href=\"?page=testimonial&btnSubmit=Modify&id=" . $formul['id'] . "\">Modify</a><br>\n";
866         }
867
868         return print_formul($formul);
869 }
870
871 function print_formul($formul)
872 {
873    global $country_lst, $org_type_lst, $org_industry_lst, $os_lst,$catalog_lst;
874
875    ?>
876    <table width="80%">
877    <td>
878    <b><? echo ($formul['publish_orgname'])?$formul['org_name']:'N/A' ?></b><br>
879    <table>
880    <tr><td> Location: </td><td><? $a = $formul['country_id'] ; echo $country_lst[$a] ?> </td></tr>
881    <tr><td> Organization Type: </td><td><? echo $org_type_lst[$formul['orgtype_id']] ?> </td></tr>
882    <tr><td> Industry/Function: </td><td><? echo $org_industry_lst[$formul['orgindustry_id']] ?> </td></tr>
883
884    <? if ($formul['publish_orgsize']) { ?>
885         <tr><td> Organisation Size: </td><td><? echo $formul['org_size'] ?> </td></tr>
886    <? } ?>
887
888    <? if ($formul['publish_website']) { ?>
889         <tr><td> Website: </td><td><? echo $formul['website'] ?> </td></tr>
890    <? } ?>
891
892    <? if ($formul['number_fd'] > 1) { ?>
893         <tr><td> Number of fd: </td><td><? echo $formul['number_fd'] ?> </td></tr>
894    <? } ?>
895
896    <? if ($formul['month_gb'] > 1) { ?>
897         <tr><td> GB/Month: </td><td><? echo $formul['month_gb'] ?> </td></tr>
898    <? } ?>
899
900    <tr><td> Comments: </td><td width='450'><i><? echo $formul['comments'] ?> </i></td></tr>
901    <? if ($formul['publish_contact']) { ?>
902         <tr align='right'><td></td><td><i><? echo $formul['contact_name'] ?> </i></td></tr>
903    <? } ?>
904    </table>
905    </td>
906    <td>
907    <? if ($formul['org_logo']) { ?>
908         <a href="<? echo $formul['org_logo'] ?>" ><img width='150' src="<? echo $formul['org_logo'] ?>"></a>
909    <? } ?>
910    </td>
911    </table>
912 <?
913    return 1;
914 }
915
916 ?>
917 <? require_once("inc/footer.php"); ?>