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