File: /var/www/vhosts/paiskincare.com/httpdocs/zencart_zendesk_install.php
<?php
// installation
require('includes/application_top.php');
$success_message = "Zendesk Connector successfully installed<br>Please configure the Connector in your Admin-Site.";
// run installation
$check_query = "select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'ZENDESK_TOKEN'";
$check = $db->Execute($check_query);
if ($check->RecordCount() > 0) {
// in case of configuration caching
$message = $success_message;
} else {
$sql = "INSERT " . TABLE_CONFIGURATION_GROUP . "
(configuration_group_title, configuration_group_description, visible) VALUES ('Zendesk Connector', 'Configuration for Zendesk Remote Authentication Connector', '1')";
$db->Execute($sql);
$configuration_group_id = $db->insert_ID();
$sql_data_array = array('configuration_title' => 'Authentication token',
'configuration_key' => 'ZENDESK_TOKEN',
'configuration_value' => 'please insert your personal Authentication token',
'configuration_description' => 'Enable remote authentication in your Zendesk Administration and copy the Zendesk-Authentication token',
'configuration_group_id' => $configuration_group_id,
'sort_order' => '1',
'date_added' => 'now()');
zen_db_perform(TABLE_CONFIGURATION, $sql_data_array);
$sql_data_array = array('configuration_title' => 'Zendesk Frontend Integration - show helpdesk',
'configuration_key' => 'ZENDESK_ENABLED',
'configuration_value' => 'false',
'configuration_description' => 'Do you want to enable the Zendesk Frontend Integration on the account page?<br>
true: enabled<br>
false: disabled',
'configuration_group_id' => $configuration_group_id,
'sort_order' => '2',
'date_added' => 'now()');
zen_db_perform(TABLE_CONFIGURATION, $sql_data_array);
$sql_data_array = array('configuration_title' => 'Zendesk Frontend Integration - Show open Tickets (curl & PHP 5 >= 5.1.3 required)',
'configuration_key' => 'ZENDESK_ENABLED_SHOW_TICKETS',
'configuration_value' => 'false',
'configuration_description' => 'Do you want to list open Tickets in the Zendesk Frontend Integration? (curl & PHP 5 >= 5.1.3 required)<br>
true: enabled<br>
false: disabled',
'configuration_group_id' => $configuration_group_id,
'sort_order' => '3',
'date_added' => 'now()');
zen_db_perform(TABLE_CONFIGURATION, $sql_data_array);
$sql_data_array = array('configuration_title' => 'Zendesk Domain',
'configuration_key' => 'ZENDESK_DOMAIN',
'configuration_value' => 'YOURDOMAIN.zendesk.com',
'configuration_description' => 'Please adjust the Return URL for your Zendesk , like YOURDOMAIN.zendesk.com',
'configuration_group_id' => $configuration_group_id,
'sort_order' => '4',
'date_added' => 'now()');
zen_db_perform(TABLE_CONFIGURATION, $sql_data_array);
$sql_data_array = array('configuration_title' => 'Zendesk API agent email',
'configuration_key' => 'ZENDESK_API_AGENT_EMAIL',
'configuration_value' => 'agent@yourshop.com',
'configuration_description' => 'Please enter the email-address of the agent account you would like to use for the API',
'configuration_group_id' => $configuration_group_id,
'sort_order' => '5',
'date_added' => 'now()');
zen_db_perform(TABLE_CONFIGURATION, $sql_data_array);
$sql_data_array = array('configuration_title' => 'Zendesk API agent password',
'configuration_key' => 'ZENDESK_API_AGENT_PASSWORD',
'configuration_value' => 'p-a-s-s-w-o-r-d',
'configuration_description' => 'Please enter the password of the agent account you would like to use for the API',
'configuration_group_id' => $configuration_group_id,
'sort_order' => '6',
'date_added' => 'now()');
zen_db_perform(TABLE_CONFIGURATION, $sql_data_array);
$message = $success_message;
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<div style="border: 2px solid green; padding: 30px; font-size: 24px;"><?php echo zen_image(DIR_WS_IMAGES . 'account_helpdesk.gif', '', '', '', 'align="left"'); ?><?php echo $message; ?></div>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>