本文整理汇总了PHP中Contact::getContacts方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::getContacts方法的具体用法?PHP Contact::getContacts怎么用?PHP Contact::getContacts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact::getContacts方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->bootstrap = true;
if (Configuration::get('PS_LOG_EMAILS')) {
$this->table = 'mail';
$this->className = 'Mail';
$this->lang = false;
$this->noLink = true;
$this->list_no_link = true;
$this->explicitSelect = true;
$this->addRowAction('delete');
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash'));
foreach (Language::getLanguages() as $language) {
$languages[$language['id_lang']] = $language['name'];
}
$this->fields_list = array('id_mail' => array('title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'recipient' => array('title' => $this->l('Recipient')), 'template' => array('title' => $this->l('Template')), 'language' => array('title' => $this->l('Language'), 'type' => 'select', 'color' => 'color', 'list' => $languages, 'filter_key' => 'a!id_lang', 'filter_type' => 'int', 'order_key' => 'language'), 'subject' => array('title' => $this->l('Subject')), 'date_add' => array('title' => $this->l('Sent'), 'type' => 'datetime'));
$this->_select .= 'l.name as language';
$this->_join .= ' LEFT JOIN ' . _DB_PREFIX_ . 'lang l ON (a.id_lang = l.id_lang)';
$this->_use_found_rows = false;
}
parent::__construct();
foreach (Contact::getContacts($this->context->language->id) as $contact) {
$arr[] = array('email_message' => $contact['id_contact'], 'name' => $contact['name']);
}
$this->fields_options = array('email' => array('title' => $this->l('Email'), 'icon' => 'icon-envelope', 'fields' => array('PS_MAIL_EMAIL_MESSAGE' => array('title' => $this->l('Send email to'), 'desc' => $this->l('Where customers send messages from the order page.'), 'validation' => 'isUnsignedId', 'type' => 'select', 'cast' => 'intval', 'identifier' => 'email_message', 'list' => $arr), 'PS_MAIL_METHOD' => array('title' => '', 'validation' => 'isGenericName', 'type' => 'radio', 'required' => true, 'choices' => array(3 => $this->l('Never send emails (may be useful for testing purposes)'), 2 => $this->l('Set my own SMTP parameters (for advanced users ONLY)'))), 'PS_MAIL_TYPE' => array('title' => '', 'validation' => 'isGenericName', 'type' => 'radio', 'required' => true, 'choices' => array(Mail::TYPE_HTML => $this->l('Send email in HTML format'), Mail::TYPE_TEXT => $this->l('Send email in text format'), Mail::TYPE_BOTH => $this->l('Both'))), 'PS_LOG_EMAILS' => array('title' => $this->l('Log Emails'), 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool')), 'submit' => array('title' => $this->l('Save'))), 'smtp' => array('title' => $this->l('Email'), 'fields' => array('PS_MAIL_DOMAIN' => array('title' => $this->l('Mail domain name'), 'hint' => $this->l('Fully qualified domain name (keep this field empty if you don\'t know).'), 'empty' => true, 'validation' => 'isUrl', 'type' => 'text'), 'PS_MAIL_SERVER' => array('title' => $this->l('SMTP server'), 'hint' => $this->l('IP address or server name (e.g. smtp.mydomain.com).'), 'validation' => 'isGenericName', 'type' => 'text'), 'PS_MAIL_USER' => array('title' => $this->l('SMTP username'), 'hint' => $this->l('Leave blank if not applicable.'), 'validation' => 'isGenericName', 'type' => 'text'), 'PS_MAIL_PASSWD' => array('title' => $this->l('SMTP password'), 'hint' => $this->l('Leave blank if not applicable.'), 'validation' => 'isAnything', 'type' => 'password', 'autocomplete' => false), 'PS_MAIL_SMTP_ENCRYPTION' => array('title' => $this->l('Encryption'), 'hint' => $this->l('Use an encrypt protocol'), 'desc' => extension_loaded('openssl') ? '' : '/!\\ ' . $this->l('SSL does not seem to be available on your server.'), 'type' => 'select', 'cast' => 'strval', 'identifier' => 'mode', 'list' => array(array('mode' => 'off', 'name' => $this->l('None')), array('mode' => 'tls', 'name' => $this->l('TLS')), array('mode' => 'ssl', 'name' => $this->l('SSL')))), 'PS_MAIL_SMTP_PORT' => array('title' => $this->l('Port'), 'hint' => $this->l('Port number to use.'), 'validation' => 'isInt', 'type' => 'text', 'cast' => 'intval', 'class' => 'fixed-width-sm')), 'submit' => array('title' => $this->l('Save'))), 'test' => array('title' => $this->l('Test your email configuration'), 'hide_multishop_checkbox' => true, 'fields' => array('PS_SHOP_EMAIL' => array('title' => $this->l('Send a test email to'), 'type' => 'text', 'id' => 'testEmail', 'no_multishop_checkbox' => true)), 'bottom' => '<div class="row"><div class="col-lg-9 col-lg-offset-3">
<div class="alert" id="mailResultCheck" style="display:none;"></div>
</div></div>', 'buttons' => array(array('title' => $this->l('Send a test email'), 'icon' => 'process-icon-envelope', 'name' => 'btEmailTest', 'js' => 'verifyMail()', 'class' => 'btn btn-default pull-right'))));
if (!defined('_PS_HOST_MODE_')) {
$this->fields_options['email']['fields']['PS_MAIL_METHOD']['choices'][1] = $this->l('Use PHP\'s mail() function (recommended; works in most cases)');
}
ksort($this->fields_options['email']['fields']['PS_MAIL_METHOD']['choices']);
}
示例2: __construct
public function __construct()
{
$this->className = 'Configuration';
$this->table = 'configuration';
parent::__construct();
foreach (Contact::getContacts($this->context->language->id) as $contact) {
$arr[] = array('email_message' => $contact['id_contact'], 'name' => $contact['name']);
}
$this->fields_options = array('email' => array('title' => $this->l('E-mail'), 'icon' => 'email', 'fields' => array('PS_MAIL_EMAIL_MESSAGE' => array('title' => $this->l('Send e-mail to'), 'desc' => $this->l('Where customers send messages from order page'), 'validation' => 'isUnsignedId', 'type' => 'select', 'cast' => 'intval', 'identifier' => 'email_message', 'list' => $arr), 'PS_MAIL_METHOD' => array('title' => '', 'validation' => 'isGenericName', 'type' => 'radio', 'required' => true, 'choices' => array(1 => $this->l('Use PHP mail() function. Recommended; works in most cases'), 2 => $this->l('Set my own SMTP parameters. For advanced users ONLY')), 'js' => array(1 => 'onclick="$(\'#smtp\').slideUp();"', 2 => 'onclick="$(\'#smtp\').slideDown();"'), 'visibility' => Shop::CONTEXT_ALL), 'PS_MAIL_TYPE' => array('title' => '', 'validation' => 'isGenericName', 'type' => 'radio', 'required' => true, 'choices' => array(Mail::TYPE_HTML => $this->l('Send e-mail as HTML'), Mail::TYPE_TEXT => $this->l('Send e-mail as Text'), Mail::TYPE_BOTH => $this->l('Both')))), 'submit' => array()), 'smtp' => array('title' => $this->l('E-mail'), 'icon' => 'email', 'top' => '<div id="smtp" style="display: ' . (Configuration::get('PS_MAIL_METHOD') == 2 ? 'block' : 'none') . ';">', 'bottom' => '</div>', 'fields' => array('PS_MAIL_DOMAIN' => array('title' => $this->l('Mail domain name:'), 'desc' => $this->l('Fully qualified domain name (keep empty if you do not know)'), 'empty' => true, 'validation' => 'isUrl', 'size' => 30, 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL), 'PS_MAIL_SERVER' => array('title' => $this->l('SMTP server:'), 'desc' => $this->l('IP address or server name (e.g. smtp.mydomain.com)'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL), 'PS_MAIL_USER' => array('title' => $this->l('SMTP user:'), 'desc' => $this->l('Leave blank if not applicable'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL), 'PS_MAIL_PASSWD' => array('title' => $this->l('SMTP password:'), 'desc' => $this->l('Leave blank if not applicable'), 'validation' => 'isAnything', 'size' => 30, 'type' => 'password', 'visibility' => Shop::CONTEXT_ALL, 'autocomplete' => false), 'PS_MAIL_SMTP_ENCRYPTION' => array('title' => $this->l('Encryption:'), 'desc' => $this->l('Use an encrypt protocol'), 'type' => 'select', 'cast' => 'strval', 'identifier' => 'mode', 'list' => array(array('mode' => 'off', 'name' => $this->l('None')), array('mode' => 'tls', 'name' => $this->l('TLS')), array('mode' => 'ssl', 'name' => $this->l('SSL'))), 'visibility' => Shop::CONTEXT_ALL), 'PS_MAIL_SMTP_PORT' => array('title' => $this->l('Port:'), 'desc' => $this->l('Port number to use'), 'validation' => 'isInt', 'size' => 5, 'type' => 'text', 'cast' => 'intval', 'visibility' => Shop::CONTEXT_ALL)), 'submit' => array()), 'test' => array('title' => $this->l('Test your e-mail configuration'), 'icon' => 'email', 'fields' => array('PS_SHOP_EMAIL' => array('title' => $this->l('Send a test e-mail to'), 'type' => 'text', 'size' => 40, 'id' => 'testEmail')), 'bottom' => '<div class="margin-form"><input type="button" class="button" name="btEmailTest" id="btEmailTest" value="' . $this->l('Send an e-mail test') . '" onclick="verifyMail();" /><br />
<p id="mailResultCheck" style="display:none;"></p></div>'));
}
示例3: __construct
public function __construct()
{
global $cookie;
$this->className = 'Configuration';
$this->table = 'configuration';
foreach (Contact::getContacts((int) $cookie->id_lang) as $contact) {
$arr[] = array('email_message' => $contact['id_contact'], 'name' => $contact['name']);
}
$this->_fieldsEmail = array('PS_MAIL_EMAIL_MESSAGE' => array('title' => $this->l('Send e-mail to:'), 'desc' => $this->l('When customers send message from order page'), 'validation' => 'isUnsignedId', 'type' => 'select', 'cast' => 'intval', 'identifier' => 'email_message', 'list' => $arr), 'PS_MAIL_METHOD' => array('title' => '', 'validation' => 'isGenericName', 'required' => true, 'type' => 'radio', 'choices' => array(1 => $this->l('Use PHP mail() function. Recommended; works in most cases'), 2 => $this->l('Set my own SMTP parameters. For advanced users ONLY')), 'js' => array(1 => 'onclick="$(\'#SMTP_CONTAINER\').slideUp();"', 2 => 'onclick="$(\'#SMTP_CONTAINER\').slideDown();"')), 'PS_MAIL_TYPE' => array('title' => '', 'validation' => 'isGenericName', 'required' => true, 'type' => 'radio', 'choices' => array(1 => $this->l('Send e-mail as HTML'), 2 => $this->l('Send e-mail as Text'), 3 => $this->l('Both'))), 'SMTP_CONTAINER' => array('title' => '', 'type' => 'container'), 'PS_MAIL_DOMAIN' => array('title' => $this->l('Mail domain:'), 'desc' => $this->l('Fully qualified domain name (keep it empty if you do not know)'), 'validation' => 'isUrl', 'size' => 30, 'type' => 'text'), 'PS_MAIL_SERVER' => array('title' => $this->l('SMTP server:'), 'desc' => $this->l('IP or server name (e.g., smtp.mydomain.com)'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'text'), 'PS_MAIL_USER' => array('title' => $this->l('SMTP user:'), 'desc' => $this->l('Leave blank if not applicable'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'text'), 'PS_MAIL_PASSWD' => array('title' => $this->l('SMTP password:'), 'desc' => $this->l('Leave blank if not applicable'), 'validation' => 'isAnything', 'size' => 30, 'type' => 'password'), 'PS_MAIL_SMTP_ENCRYPTION' => array('title' => $this->l('Encryption:'), 'desc' => $this->l('Use an encrypt protocol'), 'type' => 'select', 'cast' => 'strval', 'identifier' => 'mode', 'list' => array(array('mode' => 'off', 'name' => $this->l('None')), array('mode' => 'tls', 'name' => $this->l('TLS')), array('mode' => 'ssl', 'name' => $this->l('SSL')))), 'PS_MAIL_SMTP_PORT' => array('title' => $this->l('Port:'), 'desc' => $this->l('Number of port to use'), 'validation' => 'isInt', 'size' => 5, 'type' => 'text', 'cast' => 'intval'), 'SMTP_CONTAINER_END' => array('title' => '', 'type' => 'container_end', 'content' => '<script type="text/javascript">if (getE("PS_MAIL_METHOD2_on").checked == false) { $(\'#SMTP_CONTAINER\').hide(); }</script>'));
parent::__construct();
}
示例4: __construct
public function __construct()
{
$this->bootstrap = true;
$this->className = 'Configuration';
$this->table = 'configuration';
parent::__construct();
foreach (Contact::getContacts($this->context->language->id) as $contact) {
$arr[] = array('email_message' => $contact['id_contact'], 'name' => $contact['name']);
}
$this->fields_options = array('email' => array('title' => $this->l('Email'), 'icon' => 'icon-envelope', 'fields' => array('PS_MAIL_EMAIL_MESSAGE' => array('title' => $this->l('Send email to'), 'desc' => $this->l('Where customers send messages from the order page.'), 'validation' => 'isUnsignedId', 'type' => 'select', 'cast' => 'intval', 'identifier' => 'email_message', 'list' => $arr), 'PS_MAIL_METHOD' => array('title' => '', 'validation' => 'isGenericName', 'type' => 'radio', 'required' => true, 'choices' => array(3 => $this->l('Never send emails (may be useful for testing purposes)'), 1 => $this->l('Use PHP\'s mail() function (recommended; works in most cases)'), 2 => $this->l('Set my own SMTP parameters (for advanced users ONLY)')), 'js' => array(1 => 'onclick="$(\'#configuration_fieldset_smtp\').slideUp();"', 2 => 'onclick="$(\'#configuration_fieldset_smtp\').slideDown();"', 3 => 'onclick="$(\'#configuration_fieldset_smtp\').slideUp();"'), 'visibility' => Shop::CONTEXT_ALL), 'PS_MAIL_TYPE' => array('title' => '', 'validation' => 'isGenericName', 'type' => 'radio', 'required' => true, 'choices' => array(Mail::TYPE_HTML => $this->l('Send email in HTML format'), Mail::TYPE_TEXT => $this->l('Send email in text format'), Mail::TYPE_BOTH => $this->l('Both')))), 'submit' => array('title' => $this->l('Save'))), 'smtp' => array('title' => $this->l('Email'), 'fields' => array('PS_MAIL_DOMAIN' => array('title' => $this->l('Mail domain name'), 'hint' => $this->l('Fully qualified domain name (keep this field empty if you don\'t know).'), 'empty' => true, 'validation' => 'isUrl', 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL), 'PS_MAIL_SERVER' => array('title' => $this->l('SMTP server'), 'hint' => $this->l('IP address or server name (e.g. smtp.mydomain.com).'), 'validation' => 'isGenericName', 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL), 'PS_MAIL_USER' => array('title' => $this->l('SMTP user'), 'hint' => $this->l('Leave blank if not applicable.'), 'validation' => 'isGenericName', 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL), 'PS_MAIL_PASSWD' => array('title' => $this->l('SMTP password'), 'hint' => $this->l('Leave blank if not applicable.'), 'validation' => 'isAnything', 'type' => 'password', 'visibility' => Shop::CONTEXT_ALL, 'autocomplete' => false), 'PS_MAIL_SMTP_ENCRYPTION' => array('title' => $this->l('Encryption'), 'hint' => $this->l('Use an encrypt protocol'), 'desc' => Tools::apacheModExists('mod_ssl') ? '/!\\ ' . $this->l('SSL mod seems to not be installed on your server.') : '', 'type' => 'select', 'cast' => 'strval', 'identifier' => 'mode', 'list' => array(array('mode' => 'off', 'name' => $this->l('None')), array('mode' => 'tls', 'name' => $this->l('TLS')), array('mode' => 'ssl', 'name' => $this->l('SSL'))), 'visibility' => Shop::CONTEXT_ALL), 'PS_MAIL_SMTP_PORT' => array('title' => $this->l('Port'), 'hint' => $this->l('Port number to use.'), 'validation' => 'isInt', 'type' => 'text', 'cast' => 'intval', 'visibility' => Shop::CONTEXT_ALL)), 'submit' => array('title' => $this->l('Save'))), 'test' => array('title' => $this->l('Test your email configuration'), 'hide_multishop_checkbox' => true, 'fields' => array('PS_SHOP_EMAIL' => array('title' => $this->l('Send a test email to'), 'type' => 'text', 'id' => 'testEmail', 'no_multishop_checkbox' => true)), 'bottom' => '<div class="row"><div class="col-lg-9 col-lg-offset-3">
<div class="alert" id="mailResultCheck" style="display:none;"></div>
</div></div>', 'buttons' => array(array('title' => $this->l('Send an email test'), 'icon' => 'process-icon-envelope', 'name' => 'btEmailTest', 'js' => 'verifyMail()', 'class' => 'btn btn-default pull-right'))));
}
示例5: ajaxProcessSyncImap
public function ajaxProcessSyncImap()
{
if ($this->tabAccess['edit'] != '1') {
throw new PrestaShopException(Tools::displayError('You do not have permission to edit this.'));
}
if (Tools::isSubmit('syncImapMail')) {
if (!($url = Configuration::get('PS_SAV_IMAP_URL')) || !($port = Configuration::get('PS_SAV_IMAP_PORT')) || !($user = Configuration::get('PS_SAV_IMAP_USER')) || !($password = Configuration::get('PS_SAV_IMAP_PWD'))) {
die('{"hasError" : true, "errors" : ["Configuration is not correct"]}');
}
$conf = Configuration::getMultiple(array('PS_SAV_IMAP_OPT_NORSH', 'PS_SAV_IMAP_OPT_SSL', 'PS_SAV_IMAP_OPT_VALIDATE-CERT', 'PS_SAV_IMAP_OPT_NOVALIDATE-CERT', 'PS_SAV_IMAP_OPT_TLS', 'PS_SAV_IMAP_OPT_NOTLS'));
$conf_str = '';
if ($conf['PS_SAV_IMAP_OPT_NORSH']) {
$conf_str .= '/norsh';
}
if ($conf['PS_SAV_IMAP_OPT_SSL']) {
$conf_str .= '/ssl';
}
if ($conf['PS_SAV_IMAP_OPT_VALIDATE-CERT']) {
$conf_str .= '/validate-cert';
}
if ($conf['PS_SAV_IMAP_OPT_NOVALIDATE-CERT']) {
$conf_str .= '/novalidate-cert';
}
if ($conf['PS_SAV_IMAP_OPT_TLS']) {
$conf_str .= '/tls';
}
if ($conf['PS_SAV_IMAP_OPT_NOTLS']) {
$conf_str .= '/notls';
}
if (!function_exists('imap_open')) {
die('{"hasError" : true, "errors" : ["imap is not installed on this server"]}');
}
$mbox = @imap_open('{' . $url . ':' . $port . $conf_str . '}', $user, $password);
//checks if there is no error when connecting imap server
$errors = array_unique(imap_errors());
$str_errors = '';
$str_error_delete = '';
if (sizeof($errors) && is_array($errors)) {
$str_errors = '';
foreach ($errors as $error) {
$str_errors .= $error . ', ';
}
$str_errors = rtrim(trim($str_errors), ',');
}
//checks if imap connexion is active
if (!$mbox) {
$array = array('hasError' => true, 'errors' => array('Cannot connect to the mailbox :<br />' . $str_errors));
die(Tools::jsonEncode($array));
}
//Returns information about the current mailbox. Returns FALSE on failure.
$check = imap_check($mbox);
if (!$check) {
die('{"hasError" : true, "errors" : ["Fail to get information about the current mailbox"]}');
}
if ($check->Nmsgs == 0) {
die('{"hasError" : true, "errors" : ["NO message to sync"]}');
}
$result = imap_fetch_overview($mbox, "1:{$check->Nmsgs}", 0);
foreach ($result as $overview) {
//check if message exist in database
if (isset($overview->subject)) {
$subject = $overview->subject;
} else {
$subject = '';
}
//Creating an md5 to check if message has been allready processed
$md5 = md5($overview->date . $overview->from . $subject . $overview->msgno);
$exist = Db::getInstance()->getValue('SELECT `md5_header`
FROM `' . _DB_PREFIX_ . 'customer_message_sync_imap`
WHERE `md5_header` = \'' . pSQL($md5) . '\'');
if ($exist) {
if (Configuration::get('PS_SAV_IMAP_DELETE_MSG')) {
if (!imap_delete($mbox, $overview->msgno)) {
$str_error_delete = ', Fail to delete message';
}
}
} else {
//check if subject has id_order
preg_match('/\\#ct([0-9]*)/', $subject, $matches1);
preg_match('/\\#tc([0-9-a-z-A-Z]*)/', $subject, $matches2);
$matchFound = false;
if (isset($matches1[1]) && isset($matches2[1])) {
$matchFound = true;
}
$new_ct = Configuration::get('PS_SAV_IMAP_CREATE_THREADS') && !$matchFound && strpos($subject, '[no_sync]') == false;
if ($matchFound || $new_ct) {
if ($new_ct) {
if (!preg_match('/<(' . Tools::cleanNonUnicodeSupport('[a-z\\p{L}0-9!#$%&\'*+\\/=?^`{}|~_-]+[.a-z\\p{L}0-9!#$%&\'*+\\/=?^`{}|~_-]*@[a-z\\p{L}0-9]+[._a-z\\p{L}0-9-]*\\.[a-z0-9]+') . ')>/', $overview->from, $result) || !Validate::isEmail($from = $result[1])) {
continue;
}
// we want to assign unrecognized mails to the right contact category
$contacts = Contact::getContacts($this->context->language->id);
if (!$contacts) {
continue;
}
foreach ($contacts as $contact) {
if (strpos($overview->to, $contact['email']) !== false) {
$id_contact = $contact['id_contact'];
}
}
//.........这里部分代码省略.........
示例6: getShopContacts
/**
* Get available shop contacts.
*/
protected function getShopContacts()
{
return Contact::getContacts($this->context->language->id);
}
示例7: initContent
/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$this->assignOrderList();
$email = Tools::safeOutput(Tools::getValue('from', isset($this->context->cookie) && isset($this->context->cookie->email) && Validate::isEmail($this->context->cookie->email) ? $this->context->cookie->email : ''));
$this->context->smarty->assign(array('errors' => $this->errors, 'email' => $email, 'fileupload' => Configuration::get('PS_CUSTOMER_SERVICE_FILE_UPLOAD')));
if ($id_customer_thread = (int) Tools::getValue('id_customer_thread') && ($token = Tools::getValue('token'))) {
$customerThread = Db::getInstance()->getRow('
SELECT cm.*
FROM ' . _DB_PREFIX_ . 'customer_thread cm
WHERE cm.id_customer_thread = ' . (int) $id_customer_thread . '
AND cm.id_shop = ' . (int) $this->context->shop->id . '
AND token = \'' . pSQL($token) . '\'
');
$this->context->smarty->assign('customerThread', $customerThread);
}
$this->context->smarty->assign(array('contacts' => Contact::getContacts($this->context->language->id), 'message' => html_entity_decode(Tools::getValue('message'))));
$this->setTemplate(_PS_THEME_DIR_ . 'contact-form.tpl');
}
示例8: htmlspecialchars
<?php
/**
* about.php
*
* Content for About us page
*
* @version 1.2 2011-02-03
* @package Smithside Auctions
* @copyright Copyright (c) 2011 Smithside Auctions
* @license GNU General Public License
* @since Since Release 1.0
*/
// Get the contact information
$items = Contact::getContacts();
?>
<h1>About Us<a class="button" href="index.php?content=contactmaint&id=0">Add</a></h1>
<p>We are all happy to be a part of this. Please contact any of us with questions.</p>
<ul class="ulfancy">
<?php
foreach ($items as $i => $item) {
?>
<li class="row<?php
echo $i % 2;
?>
">
<h2><?php
echo htmlspecialchars($item->name());
?>
</h2>
示例9: _buildStoreMap
protected function _buildStoreMap($item, $layout, $shopId, $langId, $cacheKey = '')
{
if (!$item) {
return '';
}
if (!$this->isCached('megaboxs.' . $layout . '.group.store_map.tpl', Tools::encrypt($cacheKey))) {
$this->context->smarty->assign(array('megaboxs_group_id' => $item['id'], 'megaboxs_group_display_title' => $item['display_title'], 'megaboxs_group_custom_class' => $item['custom_class'], 'megaboxs_group_width' => $item['width'], 'megaboxs_group_name' => $item['name'], 'megaboxs_group_content' => $item['html'], 'megaboxs_group_description' => $item['description'], 'contacts' => Contact::getContacts($this->context->language->id)));
}
return $this->display(__FILE__, 'megaboxs.' . $layout . '.group.store_map.tpl', Tools::encrypt($cacheKey));
}
示例10: generateContactData
protected function generateContactData()
{
$delimiter = ';';
$line = array();
$titles = array();
$id_lang = $this->use_lang;
$new_path = new Sampledatainstall();
$f = fopen($new_path->sendPath() . 'output/contacts.vsc', 'w');
foreach ($this->contacts_fields as $field => $array) {
$titles[] = $array['label'];
}
fputcsv($f, $titles, $delimiter, '"');
$contacts = Contact::getContacts($id_lang);
if ($contacts) {
foreach ($contacts as $contact) {
$c = new Contact($contact['id_contact'], $id_lang);
foreach ($this->contacts_fields as $field => $array) {
$line[$field] = property_exists('Contact', $field) && !is_array($c->{$field}) && !Tools::isEmpty($c->{$field}) ? $c->{$field} : '';
}
if (!$line[$field]) {
$line[$field] = '';
}
fputcsv($f, $line, $delimiter, '"');
}
}
fclose($f);
}
示例11: process
public function process()
{
parent::process();
$email = Tools::safeOutput(Tools::getValue('from', (isset(self::$cookie) and isset(self::$cookie->email) and Validate::isEmail(self::$cookie->email)) ? self::$cookie->email : ''));
self::$smarty->assign(array('errors' => $this->errors, 'email' => $email, 'fileupload' => Configuration::get('PS_CUSTOMER_SERVICE_FILE_UPLOAD')));
if ($id_customer_thread = (int) Tools::getValue('id_customer_thread') and $token = Tools::getValue('token')) {
$customerThread = Db::getInstance()->getRow('
SELECT cm.* FROM ' . _DB_PREFIX_ . 'customer_thread cm
WHERE cm.id_customer_thread = ' . (int) $id_customer_thread . ' AND token = \'' . pSQL($token) . '\'');
self::$smarty->assign('customerThread', $customerThread);
}
self::$smarty->assign(array('contacts' => Contact::getContacts((int) self::$cookie->id_lang), 'message' => html_entity_decode(Tools::getValue('message'))));
}
示例12: displayMessage
protected function displayMessage($message, $email = false, $id_employee = null)
{
$tpl = $this->createTemplate('message.tpl');
$contacts = Contact::getContacts($this->context->language->id);
foreach ($contacts as $contact) {
$contact_array[$contact['id_contact']] = array('id_contact' => $contact['id_contact'], 'name' => $contact['name']);
}
$contacts = $contact_array;
if (!$email) {
if (!empty($message['id_product']) && empty($message['employee_name'])) {
$id_order_product = Order::getIdOrderProduct((int) $message['id_customer'], (int) $message['id_product']);
}
}
$message['date_add'] = Tools::displayDate($message['date_add'], null, true);
$message['user_agent'] = strip_tags($message['user_agent']);
$message['message'] = preg_replace('/(https?:\\/\\/[a-z0-9#%&_=\\(\\)\\.\\? \\+\\-@\\/]{6,1000})([\\s\\n<])/Uui', '<a href="\\1">\\1</a>\\2', html_entity_decode($message['message'], ENT_NOQUOTES, 'UTF-8'));
$tpl->assign(array('current' => self::$currentIndex, 'token' => $this->token, 'message' => $message, 'id_order_product' => isset($id_order_product) ? $id_order_product : null, 'email' => $email, 'id_employee' => $id_employee, 'PS_SHOP_NAME' => Configuration::get('PS_SHOP_NAME'), 'file_name' => file_exists(_PS_UPLOAD_DIR_ . $message['file_name']), 'contacts' => $contacts, 'PS_CUSTOMER_SERVICE_SIGNATURE' => str_replace('\\r\\n', "\n", Configuration::get('PS_CUSTOMER_SERVICE_SIGNATURE', $message['id_lang']))));
return $tpl->fetch();
}
示例13: displayMsg
private function displayMsg($message, $email = false, $id_employee = null)
{
global $cookie, $currentIndex;
$customersToken = Tools::getAdminToken('AdminCustomers' . (int) Tab::getIdFromClassName('AdminCustomers') . (int) $cookie->id_employee);
$contacts = Contact::getContacts($cookie->id_lang);
if (!$email) {
if (!empty($message['id_product']) and empty($message['id_employee'])) {
$id_order_product = Db::getInstance()->getValue('
SELECT o.id_order
FROM ' . _DB_PREFIX_ . 'orders o
LEFT JOIN ' . _DB_PREFIX_ . 'order_detail od ON o.id_order = od.id_order
WHERE o.id_customer = ' . (int) $message['id_customer'] . '
AND od.product_id = ' . (int) $message['id_product'] . '
ORDER BY o.date_add DESC');
}
$output = '
<fieldset style="' . (!empty($message['id_employee']) ? 'background: rgb(255,236,242);' : '') . 'width:600px;margin-top:10px">
<legend ' . (empty($message['id_employee']) ? '' : 'style="background:rgb(255,210,225)"') . '>' . (!empty($message['employee_name']) ? '<img src="../img/t/AdminCustomers.gif" alt="' . Configuration::get('PS_SHOP_NAME') . '" /> ' . Configuration::get('PS_SHOP_NAME') . ' - ' . $message['employee_name'] : '<img src="' . __PS_BASE_URI__ . 'img/admin/tab-customers.gif" alt="' . Configuration::get('PS_SHOP_NAME') . '" /> ' . (!empty($message['id_customer']) ? '<a href="index.php?tab=AdminCustomers&id_customer=' . (int) $message['id_customer'] . '&viewcustomer&token=' . $customersToken . '" title="' . $this->l('View customer') . '">' . $message['customer_name'] . '</a>' : $message['email'])) . '</legend>
<div style="font-size:11px">' . ((!empty($message['id_customer']) and empty($message['id_employee'])) ? '<b>' . $this->l('Customer ID:') . '</b> <a href="index.php?tab=AdminCustomers&id_customer=' . (int) $message['id_customer'] . '&viewcustomer&token=' . $customersToken . '" title="' . $this->l('View customer') . '">' . (int) $message['id_customer'] . ' <img src="../img/admin/search.gif" alt="' . $this->l('view') . '" /></a><br />' : '') . '
<b>' . $this->l('Sent on:') . '</b> ' . Tools::displayDate($message['date_add'], (int) $cookie->id_lang, true) . '<br />' . (empty($message['id_employee']) ? '<b>' . $this->l('Browser:') . '</b> ' . strip_tags($message['user_agent']) . '<br />' : '') . ((!empty($message['file_name']) and file_exists(_PS_UPLOAD_DIR_ . $message['file_name'])) ? '<b>' . $this->l('File attachment') . '</b> <a href="index.php?tab=AdminCustomerThreads&id_customer_thread=' . $message['id_customer_thread'] . '&viewcustomer_thread&token=' . Tools::getAdminToken('AdminCustomerThreads' . (int) Tab::getIdFromClassName('AdminCustomerThreads') . (int) $cookie->id_employee) . '&filename=' . $message['file_name'] . '" title="' . $this->l('View file') . '"><img src="../img/admin/search.gif" alt="' . $this->l('view') . '" /></a><br />' : '') . ((!empty($message['id_order']) and empty($message['id_employee'])) ? '<b>' . $this->l('Order #') . '</b> <a href="index.php?tab=AdminOrders&id_order=' . (int) $message['id_order'] . '&vieworder&token=' . Tools::getAdminToken('AdminOrders' . (int) Tab::getIdFromClassName('AdminOrders') . (int) $cookie->id_employee) . '" title="' . $this->l('View order') . '">' . (int) $message['id_order'] . ' <img src="../img/admin/search.gif" alt="' . $this->l('view') . '" /></a><br />' : '') . ((!empty($message['id_product']) and empty($message['id_employee'])) ? '<b>' . $this->l('Product #') . '</b> <a href="index.php?tab=AdminOrders&id_order=' . (int) $id_order_product . '&vieworder&token=' . Tools::getAdminToken('AdminOrders' . (int) Tab::getIdFromClassName('AdminOrders') . (int) $cookie->id_employee) . '" title="' . $this->l('View order') . '">' . (int) $message['id_product'] . ' <img src="../img/admin/search.gif" alt="' . $this->l('view') . '" /></a><br />' : '') . '<br />
<form action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" method="post">
<b>' . $this->l('Subject:') . '</b>
<input type="hidden" name="id_customer_message" value="' . $message['id_customer_message'] . '" />
<select name="id_contact" onchange="this.form.submit();">';
foreach ($contacts as $contact) {
$output .= '<option value="' . (int) $contact['id_contact'] . '" ' . ($contact['id_contact'] == $message['id_contact'] ? 'selected="selected"' : '') . '>' . Tools::htmlentitiesutf8($contact['name']) . '</option>';
}
$output .= '</select>
</form>';
} else {
$output = '<div style="font-size:11px">
' . ($id_employee ? '<a href="' . Tools::getHttpHost(true) . $currentIndex . '&token=' . Tools::getAdminToken('AdminCustomerThreads' . (int) Tab::getIdFromClassName('AdminCustomerThreads') . (int) $id_employee) . '&id_customer_thread=' . (int) $message['id_customer_thread'] . '&viewcustomer_thread">' . $this->l('View this thread') . '</a><br />' : '') . '
<b>' . $this->l('Sent by:') . '</b> ' . (!empty($message['customer_name']) ? $message['customer_name'] . ' (' . $message['email'] . ')' : $message['email']) . ((!empty($message['id_customer']) and empty($message['employee_name'])) ? '<br /><b>' . $this->l('Customer ID:') . '</b> ' . (int) $message['id_customer'] . '<br />' : '') . ((!empty($message['id_order']) and empty($message['employee_name'])) ? '<br /><b>' . $this->l('Order #') . ':</b> ' . (int) $message['id_order'] . '<br />' : '') . ((!empty($message['id_product']) and empty($message['employee_name'])) ? '<br /><b>' . $this->l('Product #') . ':</b> ' . (int) $message['id_product'] . '<br />' : '') . '<br /><b>' . $this->l('Subject:') . '</b> ' . $message['subject'];
}
$message['message'] = preg_replace('/(https?:\\/\\/[a-z0-9#%&_=\\(\\)\\.\\? \\+\\-@\\/]{6,1000})([\\s\\n<])/Uui', '<a href="\\1">\\1</a>\\2', html_entity_decode($message['message'], ENT_NOQUOTES, 'UTF-8'));
$output .= '<br /><br />
<b>' . $this->l('Thread ID:') . '</b> ' . (int) $message['id_customer_thread'] . '<br />
<b>' . $this->l('Message ID:') . '</b> ' . (int) $message['id_customer_message'] . '<br />
<b>' . $this->l('Message:') . '</b><br />
' . $message['message'] . '
</div>';
if (!$email) {
if (empty($message['employee_name'])) {
$output .= '
<p style="text-align:right">
<button style="font-family: Verdana; font-size: 11px; font-weight:bold; height: 65px; width: 120px;" onclick="$(\'#reply_to_' . (int) $message['id_customer_message'] . '\').show(500); $(this).hide();">
<img src="' . __PS_BASE_URI__ . 'img/admin/contact.gif" alt="" style="margin-bottom: 5px;" /><br />' . $this->l('Reply to this message') . '
</button>
</p>
<div id="reply_to_' . (int) $message['id_customer_message'] . '" style="display: none; margin-top: 20px;"">
<form action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" method="post" enctype="multipart/form-data">
<p>' . $this->l('Please type your reply below:') . '</p>
<textarea style="width: 450px; height: 175px;" name="reply_message">' . str_replace('\\r\\n', "\n", Configuration::get('PS_CUSTOMER_SERVICE_SIGNATURE', $message['id_lang'])) . '</textarea>
<div style="width: 450px; text-align: right; font-style: italic; font-size: 9px; margin-top: 2px;">
' . $this->l('Your reply will be sent to:') . ' ' . $message['email'] . '
</div>
<div style="width: 450px; margin-top: 0px;">
<input type="file" name="joinFile"/>
<div>
<div style="width: 450px; text-align: center;">
<input type="submit" class="button" name="submitReply" value="' . $this->l('Send my reply') . '" style="margin-top:20px;" />
<input type="hidden" name="id_customer_thread" value="' . (int) $message['id_customer_thread'] . '" />
<input type="hidden" name="msg_email" value="' . $message['email'] . '" />
</div>
</form>
</div>';
}
$output .= '
</fieldset>';
}
return $output;
}
示例14: dirname
<?php
$useSSL = true;
include dirname(__FILE__) . '/config/config.inc.php';
include dirname(__FILE__) . '/header.php';
$errors = array();
$smarty->assign('contacts', Contact::getContacts(intval($cookie->id_lang)));
if (Tools::isSubmit('submitMessage')) {
$message = Tools::htmlentitiesUTF8(Tools::getValue('message'));
if (!($from = Tools::getValue('from')) or !Validate::isEmail($from)) {
$errors[] = Tools::displayError('invalid e-mail address');
} elseif (!($message = nl2br2($message))) {
$errors[] = Tools::displayError('message cannot be blank');
} elseif (!Validate::isMessage($message)) {
$errors[] = Tools::displayError('invalid message');
} elseif (!($id_contact = intval(Tools::getValue('id_contact'))) or !Validate::isLoadedObject($contact = new Contact(intval($id_contact), intval($cookie->id_lang)))) {
$errors[] = Tools::displayError('please select a contact in the list');
} else {
if (intval($cookie->id_customer)) {
$customer = new Customer(intval($cookie->id_customer));
}
if (Mail::Send(intval($cookie->id_lang), 'contact', 'Message from contact form', array('{email}' => $from, '{message}' => stripslashes($message)), $contact->email, $contact->name, $from, intval($cookie->id_customer) ? $customer->firstname . ' ' . $customer->lastname : $from)) {
$smarty->assign('confirmation', 1);
} else {
$errors[] = Tools::displayError('an error occurred while sending message');
}
}
}
$email = Tools::safeOutput(Tools::getValue('from', (isset($cookie) and isset($cookie->email) and Validate::isEmail($cookie->email)) ? $cookie->email : ''));
$smarty->assign(array('errors' => $errors, 'email' => $email));
$smarty->display(_PS_THEME_DIR_ . 'contact-form.tpl');
示例15: getTemplateVarContact
public function getTemplateVarContact()
{
$contacts = array();
$all_contacts = Contact::getContacts($this->context->language->id);
foreach ($all_contacts as $one_contact_id => $one_contact) {
$contacts[$one_contact['id_contact']] = $one_contact;
}
if ($this->customer_thread['id_contact']) {
return [$contacts[$this->customer_thread['id_contact']]];
}
return $contacts;
}