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',
'54' => 'Banking',
'42' => 'Church / Religious 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' => "Ivory Coast", '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')
{
?>
echo $_REQUEST['btnSubmit'] ?> Testimonial
|
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.
Fields marked with a * are required. Read the privacy notice below for
information about how this data will be used.
|
|
Privacy Notice
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.
|
}
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 "\n";
} elseif ($_REQUEST['btnSubmit'] == 'Review Profile Submission') {
$form = get_formul();
if (!$form) {
echo "Sorry, something is missing, I cannot 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'] . "
";
echo "You can modify your profile here (keep this link as bookmark)
";
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 has been modified.
";
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 "Add a testimonial
";
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.
";
}
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
";
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
";
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
";
// }
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;
}
}
?>
echo ($formul['publish_orgname'])?$formul['org_name']:'N/A' ?>
Location: | $a = $formul['country_id'] ; echo $country_lst[$a] ?> |
Organization Type: | echo $org_type_lst[$formul['orgtype_id']] ?> |
Industry/Function: | echo $org_industry_lst[$formul['orgindustry_id']] ?> |
if ($formul['publish_orgsize']) { ?>
Organisation Size: | echo $formul['org_size'] ?> |
} ?>
if ($formul['publish_website']) { ?>
Website: | echo $formul['website'] ?> |
} ?>
if ($formul['number_fd']) { ?>
Number of fd: | echo $formul['number_fd'] ?> |
} ?>
if ($formul['month_gb']) { ?>
GB/Month: | echo $formul['month_gb'] ?> |
} ?>
Comments: | echo $formul['comments'] ?> |
|
if ($formul['org_logo']) { ?>
} ?>
if ($formul['publish_contact']) { ?>
| | echo $formul['contact_name'] ?> |
} ?>
return 1;
}
?>
require_once("inc/footer.php"); ?>