--- /dev/null
+<? require_once("inc/header.php"); ?>
+<?
+$dat_dir = '../testimonials';
+
+$org_type_lst = array(
+ '0' => "SELECT ONE",
+ '15' => "Church / Religious Organization",
+ '3' => "Corporation",
+ '14' => "Educational Institution",
+ '5' => "Government",
+ '6' => "Military",
+ '13' => "Non-Profit Organization",
+ '10' => "Other",
+ '4' => "Small Business"
+);
+
+$version_lst = array(
+ '0' => "SELECT ONE",
+ '1' => "1.36.x",
+ '2' => "1.38.x",
+ '3' => "2.0.x",
+ '4' => "2.2.x",
+ '5' => "SVN version"
+);
+
+$catalog_lst = array(
+ '0' => "SELECT ONE",
+ '1' => "MySQL",
+ '2' => "PostgreSQL",
+ '3' => "SqLite"
+);
+
+$org_industry_lst = array(
+ '0' => 'SELECT ONE', '25' => 'Aerospace / Aeronautical',
+ '11' => 'Agriculture / Farming', '38' => 'Architecture / Design',
+ '44' => 'Arts', '5' => 'ASP',
+ '42' => 'Church / Religous Organization', '45' => 'Coaching',
+ '10' => 'Construction', '22' => 'Consulting (General)',
+ '21' => 'Consulting (Information Technology)', '31' => 'Defense Industry',
+ '51' => 'Education / Training', '37' => 'Energy Industry',
+ '46' => 'Engineering', '35' => 'Entertainment (Film)',
+ '34' => 'Entertainment (Music)', '36' => 'Entertainment (Other)',
+ '47' => 'Event Management / Conferences', '7' => 'Finance / Banking / Accounting',
+ '12' => 'Food Service Industry', '29' => 'Government',
+ '3' => 'Healthcare / Medicine', '8' => 'Higher Education',
+ '6' => 'Insurance', '4' => 'Internet Service Provider',
+ '2' => 'K-12 Education', '48' => 'Law Enforcement / Emergency Management',
+ '14' => 'Legal', '24' => 'Manufacturing (Computer Equipment)',
+ '23' => 'Manufacturing (General)', '53' => 'Media (Publishing, Broadcasting, etc)',
+ '30' => 'Military', '9' => 'Mining',
+ '18' => 'Natural Resources / Environment', '15' => 'Pharmaceuticals',
+ '49' => 'Public Relations / Advertising', '13' => 'Real Estate',
+ '41' => 'Retail / Consumer Goods', '52' => 'Sales / Marketing',
+ '32' => 'Scientific Research', '33' => 'Sports / Recreation',
+ '43' => 'Technical College / Trade School', '40' => 'Telecommunications',
+ '27' => 'Transportation Industry (Air)', '28' => 'Transportation Industry (General)',
+ '26' => 'Transportation Industry (Marine)', '50' => 'Travel / Tourism / Lodging',
+ '17' => 'Travel Industry', '39' => 'Utilities / Public Works',
+ '16' => 'Other'
+);
+
+$os_lst = array(
+ '0' => 'SELECT ONE', '20' => 'AIX',
+ '21' => 'FreeBSD', '14' => 'HP-UX',
+ '2' => 'Linux (Debian)', '27' => 'Linux (Fedora)',
+ '25' => 'Linux (Gentoo)', '4' => 'Linux (Mandrake)',
+ '5' => 'Linux (Other)', '1' => 'Linux (RedHat)',
+ '26' => 'Linux (Slackware)', '3' => 'Linux (Suse)',
+ '18' => 'Mac OS X', '22' => 'NetBSD',
+ '23' => 'OpenBSD', '24' => 'Other',
+ '13' => 'Solaris', '15' => 'Windows 2000',
+ '16' => 'Windows 2003', '17' => 'Windows XP'
+);
+
+$country_lst = array(
+ '0' => 'SELECT ONE', '1' => 'Afghanistan',
+ '2' => 'Albania', '3' => 'Algeria',
+ '4' => 'American Samoa', '5' => 'Andorra',
+ '6' => 'Angola', '7' => 'Anguilla',
+ '8' => 'Antarctica', '9' => 'Antigua and Barbuda',
+ '10' => 'Argentina', '11' => 'Armenia',
+ '12' => 'Aruba', '13' => 'Australia',
+ '14' => 'Austria', '15' => 'Azerbaijan',
+ '16' => 'Bahamas', '17' => 'Bahrain',
+ '18' => 'Bangladesh', '19' => 'Barbados',
+ '20' => 'Belarus', '21' => 'Belgium',
+ '22' => 'Belize', '23' => 'Benin',
+ '24' => 'Bermuda', '25' => 'Bhutan',
+ '26' => 'Bolivia', '27' => 'Bosnia and Herzegovina',
+ '28' => 'Botswana', '29' => 'Bouvet Island',
+ '30' => 'Brazil', '31' => 'Brunei Darussalam',
+ '32' => 'Bulgaria', '33' => 'Burkina Faso',
+ '34' => 'Burundi', '35' => 'Cambodia',
+ '36' => 'Cameroon', '37' => 'Canada',
+ '38' => 'Cape Verde', '39' => 'Cayman Islands',
+ '40' => 'Central African Republic','41' => 'Chad',
+ '42' => 'Chile', '43' => 'China',
+ '44' => 'Christmas Island', '45' => 'Colombia',
+ '46' => 'Comoros', '47' => 'Congo',
+ '48' => 'Cook Islands', '49' => 'Costa Rica',
+ '54' => "Côte d'Ivoire", '50' => 'Croatia',
+ '51' => 'Cuba', '52' => 'Cyprus',
+ '53' => 'Czech Republic', '55' => 'Denmark',
+ '56' => 'Djibouti', '57' => 'Dominica',
+ '58' => 'Dominican Republic', '59' => 'East Timor',
+ '60' => 'Ecuador', '61' => 'Egypt',
+ '62' => 'El Salvador', '63' => 'Equatorial Guinea',
+ '64' => 'Eritrea', '65' => 'Estonia',
+ '66' => 'Ethiopia', '67' => 'Falkland Islands',
+ '68' => 'Faroe Islands', '69' => 'Fiji',
+ '70' => 'Finland', '71' => 'France',
+ '72' => 'French Guiana', '73' => 'French Polynesia',
+ '74' => 'Gabon', '75' => 'Gambia',
+ '76' => 'Georgia', '77' => 'Germany',
+ '78' => 'Ghana', '79' => 'Gibraltar',
+ '80' => 'Greece', '81' => 'Greenland',
+ '82' => 'Grenada', '83' => 'Guadeloupe',
+ '84' => 'Guam', '85' => 'Guatemala',
+ '86' => 'Guinea', '87' => 'Guinea-Bissau',
+ '88' => 'Guyana', '89' => 'Haiti',
+ '90' => 'Honduras', '91' => 'Hong Kong',
+ '92' => 'Hungary', '93' => 'Iceland',
+ '94' => 'India', '95' => 'Indonesia',
+ '96' => 'Iran', '97' => 'Iraq',
+ '98' => 'Ireland', '99' => 'Israel',
+ '100' => 'Italy', '101' => 'Jamaica',
+ '102' => 'Japan', '103' => 'Jordan',
+ '104' => 'Kazakstan', '105' => 'Kenya',
+ '106' => 'Kiribati', '107' => 'Kuwait',
+ '108' => 'Kyrgystan', '109' => 'Lao',
+ '110' => 'Latvia', '111' => 'Lebanon',
+ '112' => 'Lesotho', '113' => 'Liberia',
+ '232' => 'Libya', '114' => 'Liechtenstein',
+ '115' => 'Lithuania', '116' => 'Luxembourg',
+ '117' => 'Macau', '118' => 'Macedonia (FYR)',
+ '119' => 'Madagascar', '120' => 'Malawi',
+ '121' => 'Malaysia', '122' => 'Maldives',
+ '123' => 'Mali', '124' => 'Malta',
+ '125' => 'Marshall Islands', '126' => 'Martinique',
+ '127' => 'Mauritania', '128' => 'Mauritius',
+ '129' => 'Mayotte', '130' => 'Mexico',
+ '131' => 'Micronesia', '132' => 'Moldova',
+ '133' => 'Monaco', '134' => 'Mongolia',
+ '135' => 'Montserrat', '136' => 'Morocco',
+ '137' => 'Mozambique', '138' => 'Myanmar',
+ '139' => 'Namibia', '140' => 'Nauru',
+ '141' => 'Nepal', '142' => 'Netherlands',
+ '143' => 'Netherlands Antilles', '144' => 'Neutral Zone',
+ '145' => 'New Caledonia', '146' => 'New Zealand',
+ '147' => 'Nicaragua', '148' => 'Niger',
+ '149' => 'Nigeria', '150' => 'Niue',
+ '151' => 'Norfolk Island', '152' => 'North Korea',
+ '153' => 'Northern Mariana Islands','154' => 'Norway',
+ '155' => 'Oman', '156' => 'Pakistan',
+ '157' => 'Palau', '158' => 'Panama',
+ '159' => 'Papua New Guinea', '160' => 'Paraguay',
+ '161' => 'Peru', '162' => 'Philippines',
+ '163' => 'Pitcairn', '164' => 'Poland',
+ '165' => 'Portugal', '166' => 'Puerto Rico',
+ '167' => 'Qatar', '168' => 'Reunion',
+ '169' => 'Romania', '170' => 'Russian Federation',
+ '171' => 'Rwanda', '172' => 'Saint Helena',
+ '173' => 'Saint Kitts and Nevis', '174' => 'Saint Lucia',
+ '175' => 'Saint Pierre and Miquelon','231' => 'Saint Vincent and the Grenadines',
+ '176' => 'Samoa', '177' => 'San Marino',
+ '178' => 'Sao Tome and Principe', '179' => 'Saudi Arabia',
+ '180' => 'Senegal', '227' => 'Serbia and Montenegro',
+ '181' => 'Seychelles', '182' => 'Sierra Leone',
+ '183' => 'Singapore', '184' => 'Slovakia',
+ '185' => 'Slovenia', '186' => 'Solomon Islands',
+ '187' => 'Somalia', '188' => 'South Africa',
+ '189' => 'South Georgia', '190' => 'South Korea',
+ '191' => 'Spain', '192' => 'Sri Lanka',
+ '193' => 'Sudan', '194' => 'Suriname',
+ '195' => 'Swaziland', '196' => 'Sweden',
+ '197' => 'Switzerland', '198' => 'Syria',
+ '199' => 'Taiwan', '200' => 'Tajikistan',
+ '201' => 'Tanzania', '202' => 'Thailand',
+ '203' => 'Togo', '204' => 'Tokelau',
+ '205' => 'Tonga', '206' => 'Trinidad and Tobago',
+ '207' => 'Tunisia', '208' => 'Turkey',
+ '209' => 'Turkmenistan', '210' => 'Turks and Caicos Islands',
+ '211' => 'Tuvalu', '212' => 'Uganda',
+ '213' => 'Ukraine', '214' => 'United Arab Emirates',
+ '215' => 'United Kingdom', '216' => 'United States of America',
+ '217' => 'Uruguay', '218' => 'Uzbekistan',
+ '219' => 'Vanuatu', '233' => 'Vatican City',
+ '220' => 'Venezuela', '221' => 'Vietnam',
+ '222' => 'Virgin Islands (British)','223' => 'Virgin Islands (U.S.)',
+ '224' => 'Wallis and Futuna Islands','225' => 'Western Sahara',
+ '226' => 'Yemen', '228' => 'Zaire',
+ '229' => 'Zambia', '230' => 'Zimbabwe'
+);
+
+if ($_REQUEST['btnSubmit'] == 'Add' or $_REQUEST['btnSubmit'] == 'Modify')
+{
+
+?>
+<table>
+<tr>
+ <td class="contentTopic">
+ Add Testimonial
+ </td>
+</tr>
+<tr>
+ <td class="content">
+
+Want to let others know you're using Bacula? Submit a user profile! Your
+submission will be reviewed before being made publicly available. We reserve
+the right to edit your submission for spelling, grammar, etc. You will receive
+an email when your profile has been approved for public viewing. Note that
+while your contact name and email address are required (to verify
+information if necessary), you can choose to have them not be published along
+with your profile information.
+<br/><br/>
+Fields marked with a * are required. Read the privacy notice below for
+information about how this data will be used.
+
+ </td>
+</tr>
+
+<tr>
+ <td class="content">
+<form enctype="multipart/form-data" method='post' action='?page=testimonial'>
+<input type='hidden' name='page' value='testimonial'>
+<table border='0' class='Content'>
+
+<td class='ItemName'>
+<font color='red'>*</font>Contact Name:</td>
+<td class='ItemValue'><input type='text' class='ItemValue' id='contact_name'
+name='contact_name' size='30' maxlength='100' value=''></td>
+<td class='ItemName'>Publish Contact Name?</td>
+<td class='ItemValue'><select name='publish_contact' class='ItemValue'>
+<option id='publish_contact_0' value='0' SELECTED>No
+<option id='publish_contact_1' value='1'>Yes
+</select></td>
+</tr>
+
+<tr>
+<td class='ItemName'><font color='red'>*</font>Email Address:</td>
+<td class='ItemValue'><input type='text' class='ItemValue' name='email_address'
+id='email_address' size='30' maxlength='150' value=''></td>
+<td class='ItemName'>Publish Email Address?</td><td class='ItemValue'>
+<select name='publish_email' class='ItemValue'>
+<option value='0' id='publish_email_0' SELECTED>No
+<option value='1' id='publish_email_1' >Yes
+</select></td>
+</tr>
+
+<tr><td class='ItemName'>Job Description/Title:</td>
+<td class='ItemValue'>
+<input type='text' name='title' id='title' size='30' maxlength='100' value=''></td></tr>
+<tr><td colspan=4><br></td></tr>
+
+<tr><td class='ItemName'><font color='red'>*</font>Organization Name:</td>
+<td class='ItemValue'>
+<input type='text' class='ItemValue' name='org_name' id='org_name'
+size='30' maxlength='100' value=''>
+</td><td class='ItemName'>Publish Org Name?</td><td class='ItemValue'>
+<select name='publish_orgname' class='ItemValue'>
+<option value='0' id='publish_orgname_0' >No
+<option value='1' id='publish_orgname_1' SELECTED>Yes
+</select></td>
+</tr>
+
+<tr><td class='ItemName'><font color='red'>*</font>Organization Type:</td>
+<td class='ItemValue' colspan='3'>
+<select name='orgtype_id' class='ItemValue'>
+<?
+
+while(list ($key, $val) = each ($org_type_lst))
+{
+ echo "<option id='orgtype_id_$key' value='$key'>$val\n";
+}
+
+?>
+</select>
+</td></tr>
+
+<tr><td class='ItemName'><font color='red'>*</font>Organization Industry/Function:</td>
+<td class='ItemValue' colspan='3'>
+<select name='orgindustry_id' class='ItemValue'>
+<?
+
+while(list ($key, $val) = each ($org_industry_lst))
+{
+ echo "<option id='orgindustry_id_$key' value='$key'>$val\n";
+}
+
+?>
+</select>
+</td></tr>
+
+<tr><td class='ItemName'>
+<font color='red'>*</font>Approx. Organization Size (# of Users):</td>
+<td class='ItemValue'>
+<input type='text' id='org_size' class='ItemValue' name='org_size'
+size='4' maxlength='6' value=''></td>
+<td class='ItemName'>Publish Org Size?</td><td class='ItemValue'><select name='publish_orgsize' class='ItemValue'>
+<option id='publish_orgsize_0' value='0' >No
+<option id='publish_orgsize_1' value='1' SELECTED>Yes
+</select></td>
+</tr>
+<tr>
+
+<td class='ItemName'>Website URL:</td>
+<td class='ItemValue'>
+<input type='text' class='ItemValue' id='website' name='website' size='30'
+ maxlength='150' value=''></td>
+<td class='ItemName'>Publish Website?</td><td class='ItemValue'>
+<select name='publish_website' class='ItemValue'>
+<option id='publish_website_0' value='0' >No
+<option id='publish_website_1' value='1' SELECTED>Yes
+</select></td>
+</tr>
+
+<tr>
+<td class='ItemName'>Organization Logo:</td>
+<td class='ItemValue'>
+<input type="file" name="org_logo" title="png, gif or jpeg file only please"/>
+</td>
+</tr>
+
+<tr><td class='ItemName'><font color='red'>*</font>Country:</td>
+<td class='ItemValue'>
+<select name='country_id' class='ItemValue'>
+<?
+while(list ($key, $val) = each ($country_lst))
+{
+ echo "<option id='country_id_$key' value='$key'>$val\n";
+}
+
+?>
+</select>
+</td></tr>
+
+<tr><td colspan=4><br></td></tr>
+<tr><td class='ItemName'><font color='red'>*</font>Bacula version:</td>
+<td class='ItemValue'>
+<select name='bacula_version' class='ItemValue'>
+<?
+
+while(list ($key, $val) = each ($version_lst))
+{
+ echo "<option id='bacula_version_$key' value='$key'>$val\n";
+}
+
+?>
+</select>
+</td></tr>
+<tr><td class='ItemName'><font color='red'>*</font>Director OS:</td>
+<td class='ItemValue'>
+<select name='ostype_id' class='ItemValue'>
+<?
+
+while(list ($key, $val) = each ($os_lst))
+{
+ echo "<option id='ostype_id_$key' value='$key'>$val\n";
+}
+
+?>
+</select>
+</td></tr>
+<tr><td class='ItemName'><font color='red'>*</font>Catalog DB:</td>
+<td class='ItemValue'>
+<select name='catalog_id' class='ItemValue'>
+<?
+
+while(list ($key, $val) = each ($catalog_lst))
+{
+ echo "<option id='catalog_id_$key' value='$key'>$val\n";
+}
+
+?>
+</select>
+</td></tr>
+<tr>
+<td class='ItemName'><font color='red'>*</font>Redundant/Failover Backup Setup?</td>
+<td class='ItemValue'><select name='redundant_setup' class='ItemValue'>
+<option value='0' id='redundant_setup_0' SELECTED>No
+<option value='1' id='redundant_setup_1' >Yes
+</select></td>
+</tr>
+
+<tr><td class='ItemName'><font color='red'>*</font>Number of Client (Running bacula-fd):</td>
+<td class='ItemValue'>
+<input type='text' class='ItemValue' id='number_fd' name='number_fd'
+ size='5' maxlength='10' value=''></td>
+</tr>
+
+<tr><td class='ItemName'>
+<font color='red'>*</font>Number of Storage Daemon (Running bacula-sd):</td>
+<td class='ItemValue'>
+<input type='text' class='ItemValue' id='number_sd' name='number_sd' size='5'
+ maxlength='10' value=''></td>
+</tr>
+
+<tr><td class='ItemName'><font color='red'>*</font>Total # of GB saved every months:</td>
+<td class='ItemValue'><input type='text' class='ItemValue' name='month_gb' size='5'
+ id='month_gb' maxlength='10' value=''></td>
+</tr>
+
+<tr><td class='ItemName'><font color='red'>*</font>Number # of Files:</td>
+<td class='ItemValue'><input type='text' class='ItemValue' name='number_files'
+ id='number_files' title='select count(1) from File;' size='5' maxlength='10' value=''></td>
+</tr>
+
+<tr><td colspan=4><br></td></tr>
+
+<tr><td class='ItemName' valign='top'>Applicable Hardware and Network Information:</td>
+<td class='ItemValue' colspan='3'>
+<textarea name='hardware_comments' wrap='virtual' rows='4' id='hardware_comments'
+ cols='60' class='ItemValue'>Loader Description:
+Barcode Reader: Yes/No
+Number of Storage Elements:
+Number of Import/Export Elements:
+--
+Nics:
+...
+</textarea>
+</tr>
+
+<tr><td class='ItemName' valign='top'>General Comments:</td>
+<td class='ItemValue' colspan='3'>
+<textarea name='comments' id='comments' wrap='virtual' rows='4' cols='60'
+ class='ItemValue'></textarea></tr>
+
+<tr><td></td><td>
+<?
+ if ($_REQUEST['btnSubmit'] == 'Modify') {
+ echo "<input type='text' title='testimonial id' id='id' name='id' class='ItemValue' value=''>";
+ echo "<input type='submit' name='btnSubmit' class='ItemValue' value='Save'>";
+ echo "<input type='submit' name='btnSubmit' class='ItemValue' onclick='confirm(\"Are you sure ?\");' value='Delete'><br>";
+ echo "<input type='hidden' name='page' class='ItemValue' value='testimonial'><br>";
+
+ echo "<input type='text' title='Password' name='passwd' class='ItemValue' value=''>";
+ echo "<input type='submit' name='btnSubmit' class='ItemValue' value='Accept'>";
+
+} else {
+ echo "<input type='submit' name='btnSubmit' class='ItemValue' value='Review Profile Submission'>";
+ echo "</form><form action='?'><input type='hidden' name='page' value='testimonial'>";
+ echo "<input type='submit' name='btnSubmit' class='ItemValue' value='ViewAll'>";
+}
+?>
+
+</td></tr>
+</table>
+</form>
+
+</td>
+</tr>
+<tr>
+
+ <td class="content">
+ <h3 style="padding: 5px; border-bottom: 1px dotted #002244"> Privacy Notice </h3>
+
+The following information is required, but you may choose to not have it
+published for public viewing if you wish: contact name, email address,
+organization name. We may use this information to verify the data you submit if
+we find the need.
+ </td>
+</tr>
+
+
+</table>
+<?
+
+}
+
+if ($_REQUEST['btnSubmit'] == 'Modify') {
+ $id = $_REQUEST['id'];
+
+ if (!ereg('^[a-zA-Z0-9\.]+$',$id)) {
+ return(0) ;
+ }
+
+ $filename="$dat_dir/profile.$id";
+ $formul = load_formul($filename);
+
+ echo "<script type='text/javascript' language='JavaScript'>\n";
+ $attribs = array('contact_name','email_address', 'org_name','title','website',
+ 'month_gb','number_files', 'number_fd','number_sd',
+ 'org_size','comments', 'hardware_comments', 'id');
+ foreach ($attribs as $arr) {
+ form_set_value($formul, $arr);
+ }
+
+ $attribs = array('publish_contact','publish_email', 'publish_orgname', 'orgtype_id',
+ 'orgindustry_id', 'publish_orgsize','publish_website', 'bacula_version',
+ 'country_id','ostype_id', 'redundant_setup', 'catalog_id');
+ foreach ($attribs as $arr) {
+ form_set_selection($formul, $arr);
+ }
+
+ echo "</script>\n";
+
+} elseif ($_REQUEST['btnSubmit'] == 'Review Profile Submission') {
+
+ $form = get_formul();
+ if (!$form) {
+ echo "Sorry, you miss something, i can't accept your submission";
+ } else {
+ $token = uniqid(md5(rand()), true);
+ $filename = "$dat_dir/profile.$token";
+
+ $form['filename'] = $filename;
+ $form['id'] = $token;
+ save_formul($form);
+
+ send_email($form['id']);
+ echo "Your submission id is " . $form['id'] . "<br>";
+ echo "You can modify your profile <a href='?page=testimonial&btnSubmit=Modify&id=" . $form['id'] . "'>here</a> (keep this link as bookmark)<br><br>";
+ print_formul($form['filename'], true);
+ }
+
+} elseif ($_REQUEST['btnSubmit'] == 'View') {
+
+ $id = $_REQUEST['id'];
+
+ if (!ereg('^[a-zA-Z0-9\.]+$',$id)) {
+ return(0) ;
+ }
+ $filename="$dat_dir/profile.$id";
+
+ print_formul($filename,true);
+
+} elseif ($_REQUEST['btnSubmit'] == 'Delete') {
+
+ $id = $_REQUEST['id'];
+
+ if (!ereg('^[a-zA-Z0-9\.]+$',$id)) {
+ return(0) ;
+ }
+ $filename="$dat_dir/profile.$id";
+
+ $form = load_formul($filename);
+
+ if ($form['org_logo'] && file_exists($form['org_logo'])) {
+ unlink($form['org_logo']);
+ }
+ if (file_exists($filename)) {
+ unlink($filename);
+ echo "Profile deleted";
+ }
+
+} elseif ($_REQUEST['btnSubmit'] == 'Accept') {
+
+ $id = $_REQUEST['id'];
+
+ if (!ereg('^[a-zA-Z0-9\.]+$',$id)) {
+ return(0) ;
+ }
+ $filename="$dat_dir/profile.$id";
+
+ $form = load_formul($filename);
+ if (is_admin()) {
+ $form['visible']=1;
+ }
+ save_formul($form);
+ echo "$id is now visible";
+ print_formul($form,1);
+
+} elseif ($_REQUEST['btnSubmit'] == 'Save') {
+
+ $id = $_REQUEST['id'];
+
+ if (!ereg('^[a-zA-Z0-9\.]+$',$id)) {
+ return(0) ;
+ }
+
+ $filename="$dat_dir/profile.$id";
+
+ if (!file_exists($filename)) {
+ echo "Can't verify your id";
+ return (0);
+ }
+
+ $form = get_formul();
+
+ $form['filename'] = $filename;
+ $form['id'] = $id;
+// $form['visible'] = false;
+
+ if (!$form['org_logo']) {
+ $form_old = load_formul($filename);
+ $form['org_logo'] = $form_old['org_logo'];
+ }
+
+ save_formul($form);
+
+ echo "Your profile have been modified.<br>";
+ print_formul($filename,true);
+
+
+} elseif (!$_REQUEST['btnSubmit'] || $_REQUEST['btnSubmit'] == 'ViewAll') {
+
+ $limit = $_REQUEST['limit'];
+ $offset = $_REQUEST['offset'];
+
+ $limit = is_int($limit)?$limit:10;
+ $offset = is_int($offset)?$limit:0;
+
+ $admin = is_admin();
+
+ if ($limit > 20) { $limit = 20 ;}
+
+ echo "<a href='?page=testimonial&btnSubmit=Add'>Add a testimonial</a><br><br>";
+
+ if ($handle = opendir($dat_dir)) {
+ /* Ceci est la facon correcte de traverser un dossier. */
+ $i = 0 ;
+ while (false !== ($file = readdir($handle))) {
+ if (preg_match("/profile.[a-z0-9\.]+/", $file)) {
+ if ($i >= $offset && $i < ($offset + $limit)) {
+ $i += print_formul("$dat_dir/$file",$admin);
+ }
+
+ if ($i > ($offset + $limit)) {
+ break;
+ }
+ }
+ }
+ closedir($handle);
+ }
+}
+
+function send_email($id)
+{
+ // Your email address
+ $email = 'kern@sibbald.com';
+
+ // The subject
+ $subject = "[BACULA] New testimonial";
+
+ // The message
+ $message = "Hi,
+there is a new testimonial at http://www.bacula.org/?page=testimonial&btnSubmit=Modify&id=$id
+
+Bye
+";
+
+ mail($email, $subject, $message, "From: eric@eb.homelinux.org");
+
+ echo "The email has been sent for approval.<br/>";
+}
+
+function save_formul($form)
+{
+ $fp = fopen($form['filename'], 'w');
+ fwrite($fp, serialize($form));
+ fclose($fp);
+}
+
+function get_formul()
+{
+ global $dat_dir;
+ $formul = array();
+ $attribs = array('contact_name','email_address', 'org_name');
+ foreach ($attribs as $arr) {
+ if (!$_REQUEST[$arr]) {
+ echo "Can't get $arr<br/>";
+ return '';
+ }
+ $formul[$arr] = preg_replace('/[^a-zA-Z0-9!\.?\:\/,;_()@\n -]/', " ", $_REQUEST[$arr]);
+ }
+
+ $attribs = array('title','website','hardware_comments','comments');
+ foreach ($attribs as $arr) {
+ $formul[$arr] = preg_replace('/[^a-zA-Z0-9!\.?\:\/,;_()@ -]/', " ", $_REQUEST[$arr]);
+ }
+
+ $attribs = array('publish_contact','publish_email', 'publish_orgname', 'orgtype_id',
+ 'orgindustry_id','org_size', 'publish_orgsize','publish_website', 'bacula_version',
+ 'country_id','ostype_id', 'redundant_setup','number_fd','number_sd',
+ 'month_gb','number_files','catalog_id');
+ foreach ($attribs as $arr) {
+ if (preg_match("/^[0-9]+$/", $_REQUEST[$arr])) {
+ $formul[$arr] = $_REQUEST[$arr];
+ }
+ }
+
+ $attribs = array('orgtype_id', 'orgindustry_id', 'org_size', 'country_id','bacula_version',
+ 'catalog_id', 'ostype_id','number_fd','number_sd', 'month_gb','number_files');
+ foreach ($attribs as $arr) {
+ if (!$formul[$arr]) {
+ echo "Can't get $arr<br/>";
+ return '';
+ }
+ }
+
+ if ($_FILES['org_logo']) {
+ $token = uniqid(md5(rand()), true);
+ $image = "upload/$token";
+
+ if (preg_match("/(jpg|jpeg)$/i", $_FILES['org_logo']['name'])) {
+ $image = "$image.jpg";
+ } elseif (preg_match("/png$/i", $_FILES['org_logo']['name'])) {
+ $image = "$image.png";
+ } elseif (preg_match("/gif$/i", $_FILES['org_logo']['name'])) {
+ $image = "$image.gif";
+ } else {
+ $image = '';
+ }
+ if ($image) {
+ $ret=move_uploaded_file($_FILES['org_logo']['tmp_name'], $image);
+ $formul['org_logo'] = $image;
+ }
+ }
+ $formul['date'] = time();
+ $formul['visible'] = false;
+
+// foreach ($formul as $key => $val) {
+// print "$key = $val<br/>";
+// }
+
+ return $formul;
+}
+
+function form_set_value($formul,$val)
+{
+ echo "document.getElementById('$val').value = '" . $formul[$val] . "';\n";
+}
+
+function form_set_selection($formul,$val)
+{
+ echo "document.getElementById('${val}_" . $formul[$val] . "').selected =true;\n";
+}
+
+// passwd file must exist in dat directory
+function is_admin()
+{
+ global $dat_dir;
+ $id = $_REQUEST['passwd'];
+
+ if (!ereg('^[a-zA-Z]+$',$id)) {
+ return(false) ;
+ }
+
+ if (file_exists("$dat_dir/$id")) {
+ return true;
+ $formul['visible'] = $val;
+ } else {
+ return false;
+ }
+}
+
+function load_formul($filename)
+{
+ if (!file_exists($filename)) {
+ return array();
+ }
+
+ if (!filesize($filename) || filesize($filename) > 10*1024*1024) {
+ return undef;
+ }
+ $fp = fopen($filename, 'r');
+ $contents = fread ($fp, filesize ($filename));
+ fclose ($fp);
+
+ $formul = unserialize($contents);
+ if (!is_array($formul)) {
+ return undef;
+ }
+
+ return $formul;
+}
+
+function print_formul($filename, $visible) {
+ global $country_lst, $org_type_lst, $org_industry_lst, $os_lst;
+
+ $formul = load_formul($filename);
+ if (!$formul) {
+ return 0;
+ }
+
+ if (!$visible) {
+ if (!$formul['visible']) {
+ return 0;
+ }
+ }
+ ?>
+ <table>
+ <td>
+ <b><? echo ($formul['publish_orgname'])?$formul['org_name']:'N/A' ?></b><br>
+ <table>
+ <tr><td> Location: </td><td><? $a = $formul['country_id'] ; echo $country_lst[$a] ?> </td></tr>
+ <tr><td> Organization Type: </td><td><? echo $org_type_lst[$formul['orgtype_id']] ?> </td></tr>
+ <tr><td> Industry/Function: </td><td><? echo $org_industry_lst[$formul['orgindustry_id']] ?> </td></tr>
+
+ <? if ($formul['publish_orgsize']) { ?>
+ <tr><td> Organisation Size: </td><td><? echo $formul['org_size'] ?> </td></tr>
+ <? } ?>
+
+ <? if ($formul['publish_website']) { ?>
+ <tr><td> Website: </td><td><? echo $formul['website'] ?> </td></tr>
+ <? } ?>
+
+ <? if ($formul['number_fd']) { ?>
+ <tr><td> Number of fd: </td><td><? echo $formul['number_fd'] ?> </td></tr>
+ <? } ?>
+
+ <? if ($formul['month_gb']) { ?>
+ <tr><td> GB/Month: </td><td><? echo $formul['month_gb'] ?> </td></tr>
+ <? } ?>
+
+ <tr><td> Comments: </td><td><i><? echo $formul['comments'] ?> </i></td></tr>
+ </table>
+ </td>
+ <td>
+ <? if ($formul['org_logo']) { ?>
+ <img width='250' src="<? echo $formul['org_logo'] ?>">
+ <? } ?>
+ <? if ($formul['publish_contact']) { ?>
+ <tr align='right'><td></td><td><i><? echo $formul['contact_name'] ?> </i></td></tr>
+ <? } ?>
+ </td>
+ </table>
+<?
+
+ return 1;
+}
+
+?>
+<? require_once("inc/footer.php"); ?>