public function execute()
 {
     $this->setLayout(new guestbook2BackendLayout());
     // Создаем экземпляр модели для получения данных из БД
     $model = new guestbook2Model();
     // Получаем все записи гостевой книги из БД
     $records = $model->getRecords(0, 0);
     foreach ($records as &$r) {
         if ($r['contact_id']) {
             $r['name'] = $r['contact_name'];
             // получаем URL на фотографию контакта
             $r['photo_url'] = waContact::getPhotoUrl($r['contact_id'], $r['photo'], 20);
         }
     }
     unset($r);
     // Передаем записи в шаблон
     $this->view->assign('records', $records);
     // Передаём в шаблон УРЛ фронтенда
     $this->view->assign('url', wa()->getRouteUrl($this->getAppId(), true));
     // Передаём в шаблон права пользователя на удаление записей из гостевой книги
     // Права описаны в конфиге lib/config/guestbookRightConfig.class.php
     $this->view->assign('rights_delete', $this->getRights('delete'));
     // Если пользователь админ приложения контакты, то показывать ссылки на контакты
     $this->view->assign('rights_contacts', $this->getUser()->isAdmin('contacts'));
 }
 public function execute()
 {
     $this->setLayout(new guestbook2BackendLayout());
     // Creating a model instance for retrieving data from the database
     // Создаем экземпляр модели для получения данных из БД
     $model = new guestbook2Model();
     // Retrieving all guestbook records from the database
     // Получаем все записи гостевой книги из БД
     $records = $model->getRecords(0, 0);
     foreach ($records as &$r) {
         if ($r['contact_id']) {
             $r['name'] = $r['contact_name'];
             // getting the contact photo URL
             // получаем URL на фотографию контакта
             $r['photo_url'] = waContact::getPhotoUrl($r['contact_id'], $r['photo'], 20);
         }
     }
     unset($r);
     // Passing records to the template
     // Передаем записи в шаблон
     $this->view->assign('records', $records);
     // Passing the frontend URL to the template
     // Передаём в шаблон УРЛ фронтенда
     $this->view->assign('url', wa()->getRouteUrl($this->getAppId(), true));
     // Passing user's record deletion access rights value to the template
     // Access rights are defined in config file lib/config/guestbookRightConfig.class.php
     // Передаём в шаблон права пользователя на удаление записей из гостевой книги
     // Права описаны в конфиге lib/config/guestbookRightConfig.class.php
     $this->view->assign('rights_delete', $this->getRights('delete'));
     // If user is an admin of the Contacts app then show links to Contacts
     // Если пользователь админ приложения контакты, то показывать ссылки на контакты
     $this->view->assign('rights_contacts', $this->getUser()->isAdmin('contacts'));
 }
 public function settingsAction($params)
 {
     $blog_id = $params['id'];
     $html = '<div class="fields-group">
     <div class="field">
         <div class="name">' . _wp('Subscribed via email') . '</div>
         <div class="value">';
     $model = new blogEmailsubscriptionModel();
     $contacts = $model->getSubscribers($blog_id);
     $rights = wa()->getUser()->getRights('contacts');
     $html .= '<ul class="menu-v">';
     if (!$contacts) {
         $html .= '<li>' . _wp('none') . '</li>';
     }
     foreach ($contacts as $c) {
         $html .= '<li>';
         if ($rights) {
             $html .= '<a href="' . wa()->getConfig()->getBackendUrl(true) . 'contacts/#/contact/' . $c['id'] . '">';
         }
         $html .= '<i class="icon16 userpic20" style="background-image: url(' . waContact::getPhotoUrl($c['id'], $c['photo'], 20) . ')"></i>';
         $html .= '<span>' . htmlspecialchars($c['name']) . '</span>';
         if ($rights) {
             $html .= '</a>';
         }
         $html .= '</li>';
     }
     $html .= '</ul></div></div></div>';
     return array('settings' => $html);
 }
 public function execute()
 {
     // Setting the frontend layout
     // Задаём лайаут для фронтенда
     $this->setLayout(new guestbook2FrontendLayout());
     // Setting the theme template
     // Задаём шаблон темы
     $this->setThemeTemplate('guestbook.html');
     // if a POST request has been received then write a new record to the database
     // Если пришёл POST-запрос, то нужно записать в БД новую запись
     if (waRequest::method() == 'post') {
         $this->add();
     }
     // Creating a model instance for retrieving data from the database
     // Создаем экземпляр модели для получения данных из БД
     $model = new guestbook2Model();
     // Retrieving the record count per page from the app's settings
     // Получаем количество записей на одной странице из настроек приложения
     $limit = $this->getConfig()->getOption('records_per_page');
     // Current page
     // Текущая страница
     $page = waRequest::param('page');
     if (!$page) {
         $page = 1;
     }
     $this->view->assign('page', $page);
     // Calculating offset
     // Вычисляем смещение
     $offset = ($page - 1) * $limit;
     // Retrieving all records from the database
     // Получаем записи гостевой книги из БД
     $records = $model->getRecords($offset, $limit);
     // Total record count
     // Всего записей
     $records_count = $model->countAll();
     $pages_count = ceil($records_count / $limit);
     $this->view->assign('pages_count', $pages_count);
     // Preparing records for being passed to the theme template
     // Подготавливаем записи для передачи в шаблон темы
     foreach ($records as &$r) {
         if ($r['contact_id']) {
             $r['name'] = htmlspecialchars($r['contact_name']);
             // getting contact photo URL
             // получаем URL на фотографию контакта
             $r['photo_url'] = waContact::getPhotoUrl($r['contact_id'], $r['photo'], 20);
         } else {
             $r['name'] = htmlspecialchars($r['name']);
         }
         $r['text'] = nl2br(htmlspecialchars($r['text']));
     }
     unset($r);
     // Passing records to the template
     // Передаем записи в шаблон
     $this->view->assign('records', $records);
     // URL portion for links to pages
     // Часть урла для ссылок на страницы
     $this->view->assign('url', wa()->getRouteUrl('/frontend'));
 }
 public function getVotedUsers($photo_id)
 {
     $photo_id = (int) $photo_id;
     $sql = "SELECT v.rate, v.datetime, c.name, c.photo, c.id \n                FROM `{$this->table}` v \n                JOIN `wa_contact` c ON v.contact_id = c.id\n                WHERE v.photo_id = {$photo_id} ORDER BY v.datetime DESC";
     $users = $this->query($sql)->fetchAll('id');
     $contacts_url = wa()->getAppUrl('contacts');
     foreach ($users as &$u) {
         $u['photo'] = waContact::getPhotoUrl($u['id'], $u['photo'], 20, 20);
         $u['url'] = $contacts_url . '#/contact/' . $u['id'] . '/';
     }
     unset($u);
     return $users;
 }
 public function commentsPrepare(&$comments)
 {
     $default = $this->getSettingValue('default');
     if ($default == 'custom') {
         $default = wa()->getConfig()->getHostUrl() . waContact::getPhotoUrl(0, false, 20);
     }
     foreach ($comments as &$comment) {
         if (isset($comment['user']) && !$comment['contact_id'] && (!$comment['auth_provider'] || $comment['auth_provider'] == blogCommentModel::AUTH_GUEST) && $comment['email']) {
             $md5 = md5(strtolower($comment['email']));
             $comment['user']['photo_url'] = $comment['user']['photo_url_20'] = "//www.gravatar.com/avatar/{$md5}?size=20&amp;default={$default}";
             unset($data);
         }
         unset($comment);
     }
 }
 public function execute()
 {
     // Задаём лайаут для фронтенда
     $this->setLayout(new guestbook2FrontendLayout());
     // Задаём шаблон темы
     $this->setThemeTemplate('guestbook.html');
     // Если пришёл POST-запрос, то нужно записать в БД новую запись
     if (waRequest::method() == 'post') {
         $this->add();
     }
     // Создаем экземпляр модели для получения данных из БД
     $model = new guestbook2Model();
     // Получаем количество записей на одной странице из настроек приложения
     $limit = $this->getConfig()->getOption('records_per_page');
     // Текущая страница
     $page = waRequest::param('page');
     if (!$page) {
         $page = 1;
     }
     $this->view->assign('page', $page);
     // Вычисляем смещение
     $offset = ($page - 1) * $limit;
     // Получаем записи гостевой книги из БД
     $records = $model->getRecords($offset, $limit);
     // Всего записей
     $records_count = $model->countAll();
     $pages_count = ceil($records_count / $limit);
     $this->view->assign('pages_count', $pages_count);
     // Подготавливаем записи для передачи в шаблон темы
     foreach ($records as &$r) {
         if ($r['contact_id']) {
             $r['name'] = htmlspecialchars($r['contact_name']);
             // получаем URL на фотографию контакта
             $r['photo_url'] = waContact::getPhotoUrl($r['contact_id'], $r['photo'], 20);
         } else {
             $r['name'] = htmlspecialchars($r['name']);
         }
         $r['text'] = nl2br(htmlspecialchars($r['text']));
     }
     unset($r);
     // Передаем записи в шаблон
     $this->view->assign('records', $records);
     // Часть урла для ссылок на страницы
     $this->view->assign('url', wa()->getRouteUrl('/frontend'));
 }
Пример #8
0
 public function commentsPrepare(&$comments)
 {
     $default = $this->getSettingValue('default');
     if ($default == 'custom') {
         $default = wa()->getConfig()->getHostUrl() . waContact::getPhotoUrl(0, false, 20);
     }
     $scheme = parse_url(wa()->getRootUrl(true), PHP_URL_SCHEME);
     foreach ($comments as &$comment) {
         if (isset($comment['user']) && !$comment['contact_id'] && (!$comment['auth_provider'] || $comment['auth_provider'] == blogCommentModel::AUTH_GUEST) && $comment['email']) {
             $md5 = md5(strtolower($comment['email']));
             $comment['user']['photo_url'] = "http://www.gravatar.com/avatar/{$md5}?size=20&amp;default={$default}";
             foreach ($comment['user'] as $field => &$data) {
                 if (preg_match('/^photo_url_([\\d]+)$/', $field, $matches)) {
                     $data = "{$scheme}://www.gravatar.com/avatar/{$md5}?size={$matches[1]}&amp;default={$default}";
                 }
             }
             unset($data);
         }
         unset($comment);
     }
 }
 /**
  * Get data for contacts in this collection.
  * @param string|array $fields
  * @param int $offset
  * @param int $limit
  * @return array [contact_id][field] = field value in appropriate field format
  * @throws waException
  */
 public function getContacts($fields = "id", $offset = 0, $limit = 50)
 {
     $sql = "SELECT " . $this->getFields($fields) . " " . $this->getSQL();
     $sql .= $this->getGroupBy();
     $sql .= $this->getHaving();
     $sql .= $this->getOrderBy();
     $sql .= " LIMIT " . ($offset ? $offset . ',' : '') . (int) $limit;
     //header("X-SQL-". mt_rand() . ": ". str_replace("\n", " ", $sql));
     $data = $this->getModel()->query($sql)->fetchAll('id');
     $ids = array_keys($data);
     //
     // Load fields from other storages
     //
     if ($ids && $this->post_fields) {
         // $fill[table][field] = null
         // needed for all rows to always contain all apropriate keys
         // in case when we're asked to load all fields from that table
         $fill = array_fill_keys(array_keys($this->post_fields), array());
         foreach (waContactFields::getAll('enabled') as $fid => $field) {
             /**
              * @var waContactField $field
              */
             $fill[$field->getStorage(true)][$fid] = false;
         }
         foreach ($this->post_fields as $table => $fields) {
             if ($table == '_internal') {
                 foreach ($fields as $f) {
                     /**
                      * @var $f string
                      */
                     if ($f == 'photo_url' || substr($f, 0, 10) == 'photo_url_') {
                         if ($f == 'photo_url') {
                             $size = null;
                         } else {
                             $size = substr($f, 10);
                         }
                         $retina = isset($this->options['photo_url_2x']) ? $this->options['photo_url_2x'] : null;
                         foreach ($data as $id => &$v) {
                             $v[$f] = waContact::getPhotoUrl($id, $v['photo'], $size, $size, $v['is_company'] ? 'company' : 'person', $retina);
                         }
                         unset($v);
                     } else {
                         switch ($f) {
                             case '_online_status':
                                 $llm = new waLoginLogModel();
                                 $contact_ids_map = $llm->select('DISTINCT contact_id')->where('datetime_out IS NULL')->fetchAll('contact_id');
                                 $timeout = waUser::getOption('online_timeout');
                                 foreach ($data as &$v) {
                                     if (isset($v['last_datetime']) && $v['last_datetime'] && $v['last_datetime'] != '0000-00-00 00:00:00') {
                                         if (time() - strtotime($v['last_datetime']) < $timeout) {
                                             if (isset($contact_ids_map[$v['id']])) {
                                                 $v['_online_status'] = 'online';
                                             } else {
                                                 $v['_online_status'] = 'offline';
                                             }
                                         }
                                     }
                                     $v['_online_status'] = 'offline';
                                 }
                                 unset($v);
                                 break;
                             case '_access':
                                 $rm = new waContactRightsModel();
                                 $accessStatus = $rm->getAccessStatus($ids);
                                 foreach ($data as $id => &$v) {
                                     if (!isset($accessStatus[$id])) {
                                         $v['_access'] = '';
                                         continue;
                                     }
                                     $v['_access'] = $accessStatus[$id];
                                 }
                                 unset($v);
                                 break;
                             default:
                                 throw new waException('Unknown internal field: ' . $f);
                         }
                     }
                 }
                 continue;
             }
             $data_fields = $fields;
             foreach ($data_fields as $k => $field_id) {
                 $f = waContactFields::get($field_id);
                 if ($f && $f instanceof waContactCompositeField) {
                     unset($data_fields[$k]);
                     $data_fields = array_merge($data_fields, $f->getField());
                 }
             }
             $model = $this->getModel($table);
             $post_data = $model->getData($ids, $data_fields);
             foreach ($post_data as $contact_id => $contact_data) {
                 foreach ($contact_data as $field_id => $value) {
                     if (!($f = waContactFields::get($field_id))) {
                         continue;
                     }
                     if (!$f->isMulti()) {
                         $post_data[$contact_id][$field_id] = isset($value[0]['data']) ? $value[0]['data'] : (is_array($value[0]) ? $value[0]['value'] : $value[0]);
                     }
                 }
             }
             if ($fields) {
                 $fill[$table] = array_fill_keys($fields, '');
             } else {
                 if (!isset($fill[$table])) {
                     $fill[$table] = array();
                 }
             }
             foreach ($data as $contact_id => $v) {
                 if (isset($post_data[$contact_id])) {
                     $data[$contact_id] += $post_data[$contact_id];
                 }
                 $data[$contact_id] += $fill[$table];
             }
         }
     }
     return $data;
 }
Пример #10
0
 public function execute()
 {
     $category_id = waRequest::request('category', 0, 'int');
     $search = waRequest::request('search');
     $start = waRequest::request('start', 0, 'int');
     $limit = 50;
     $order = waRequest::request('order', '!last_order');
     $config = $this->getConfig();
     $use_gravatar = $config->getGeneralSettings('use_gravatar');
     $gravatar_default = $config->getGeneralSettings('gravatar_default');
     // Get customers
     $scm = new shopCustomerModel();
     list($customers, $total) = $scm->getList($category_id, $search, $start, $limit, $order);
     $has_more = $start + count($customers) < $total;
     $countries = array();
     foreach ($customers as &$c) {
         $c['affiliate_bonus'] = (double) $c['affiliate_bonus'];
         if (!$c['photo'] && $use_gravatar) {
             $c['photo'] = shopHelper::getGravatar(!empty($c['email']) ? $c['email'] : '', 50, $gravatar_default);
         } else {
             $c['photo'] = waContact::getPhotoUrl($c['id'], $c['photo'], 50, 50);
         }
         $c['categories'] = array();
         if (!empty($c['address']['region']) && !empty($c['address']['country'])) {
             $countries[$c['address']['country']] = array();
         }
     }
     unset($c);
     // Add region names to addresses
     if ($countries) {
         $rm = new waRegionModel();
         foreach ($rm->where('country_iso3 IN (?)', array_keys($countries))->query() as $row) {
             $countries[$row['country_iso3']][$row['code']] = $row['name'];
         }
         foreach ($customers as &$c) {
             if (!empty($c['address']['region']) && !empty($c['address']['country'])) {
                 $country = $c['address']['country'];
                 $region = $c['address']['region'];
                 if (!empty($countries[$country]) && !empty($countries[$country][$region])) {
                     $c['address']['region_formatted'] = $countries[$country][$region];
                 }
             }
         }
         unset($c);
     }
     // Contact categories
     $ccm = new waContactCategoryModel();
     $categories = $ccm->getAll('id');
     if ($customers) {
         $ccsm = new waContactCategoriesModel();
         foreach ($ccsm->getContactsCategories(array_keys($customers)) as $c_id => $list) {
             foreach ($list as $cat_id) {
                 if (!empty($categories[$cat_id])) {
                     $customers[$c_id]['categories'][$cat_id] = $categories[$cat_id];
                 }
             }
         }
     }
     // Set up lazy loading
     if (!$has_more) {
         // Do not trigger lazy loading, show total count at end of list
         $total_customers_number = $start + count($customers);
     } else {
         $total_customers_number = null;
         // trigger lazy loading
     }
     // List title and other params depending on list type
     if ($search) {
         $title = _w('Search results');
         $hash_start = '#/search/0/' . urlencode($search) . '/';
         $discount = null;
     } else {
         if ($category_id) {
             if (!empty($categories[$category_id])) {
                 $title = $categories[$category_id]['name'];
             } else {
                 $title = _w('Unknown category') . ' ' . $category_id;
             }
             $hash_start = '#/category/' . $category_id . '/';
             if (wa()->getSetting('discount_category')) {
                 $ccdm = new shopContactCategoryDiscountModel();
                 $discount = sprintf_wp('%s%% discount', $ccdm->getDiscount($category_id));
             } else {
                 $discount = null;
             }
         } else {
             $title = _w('All customers');
             $hash_start = '#/all/0/';
             $discount = null;
         }
     }
     $lazy_loading_params = array('limit=' . $limit, 'start=' . ($start + $limit), 'order=' . $order);
     if ($search) {
         $lazy_loading_params[] = 'search=' . $search;
     } else {
         if ($category_id) {
             $lazy_loading_params[] = 'category=' . $category_id;
         }
     }
     $lazy_loading_params = implode('&', $lazy_loading_params);
     $this->view->assign('cols', self::getCols());
     $this->view->assign('title', $title);
     $this->view->assign('order', $order);
     $this->view->assign('total', $total);
     $this->view->assign('discount', $discount);
     $this->view->assign('customers', $customers);
     $this->view->assign('hash_start', $hash_start);
     $this->view->assign('category_id', $category_id);
     $this->view->assign('lazy_loading_params', $lazy_loading_params);
     $this->view->assign('total_customers_number', $total_customers_number);
 }
 public function getLogs($filters = array(), &$count = null)
 {
     $log_model = new waLogModel();
     $apps = wa()->getUser()->getApps();
     if (!isset($filters['app_id']) || !is_array($filters['app_id'])) {
         $user_filter = wa()->getUser()->getSettings('webasyst', 'dashboard_activity');
         if ($user_filter) {
             $filters['app_id'] = explode(',', $user_filter);
         }
     }
     if (!$this->getUser()->isAdmin()) {
         if (!empty($filters['app_id'])) {
             $filters['app_id'] = array_keys(array_intersect_key(array_flip($filters['app_id']), $apps));
         } else {
             $filters['app_id'] = array_keys($apps);
         }
     }
     $rows = $log_model->getLogs($filters);
     $count = count($rows);
     $apps = wa()->getApps(true);
     $apps_rows = array();
     $prev = array();
     foreach ($rows as $row_id => &$row) {
         if ($prev) {
             $flag = true;
             foreach (array('app_id', 'action', 'contact_id', 'subject_contact_id', 'params') as $k) {
                 if ($prev[$k] != $row[$k]) {
                     $flag = false;
                     break;
                 }
             }
             if ($flag) {
                 unset($rows[$row_id]);
                 continue;
             }
         }
         $contact_name = waContactNameField::formatName($row);
         if ($contact_name) {
             $row['contact_name'] = $contact_name;
         }
         if ($row['is_user']) {
             $row['contact_photo_url'] = waContact::getPhotoUrl($row['contact_id'], $row['contact_photo'], 32, 32);
         }
         $row['datetime_group'] = $this->getDatetimeGroup($row['datetime']);
         if (!empty($apps[$row['app_id']])) {
             $row['app'] = $apps[$row['app_id']];
             $logs = wa($row['app_id'])->getConfig()->getLogActions(true);
             $row['action_name'] = ifset($logs[$row['action']]['name'], $row['action']);
             if (strpos($row['action'], 'del')) {
                 $row['type'] = 4;
             } elseif (strpos($row['action'], 'add')) {
                 $row['type'] = 3;
             } else {
                 $row['type'] = 1;
             }
             $apps_rows[$row['app_id']][$row_id] = $row;
         } else {
             $row['app'] = array('name' => $row['app_id']);
             $row['action_name'] = $row['action'];
             $row['type'] = 1;
         }
         $prev = $row;
         unset($row);
     }
     foreach ($apps_rows as $app_id => $app_rows) {
         $app_rows = wa($app_id)->getConfig()->explainLogs($app_rows);
         foreach ($app_rows as $row_id => $row) {
             if ($row) {
                 $rows[$row_id] = $row;
             } else {
                 unset($rows[$row_id]);
             }
         }
     }
     return $rows;
 }
Пример #12
0
 /** Get all history for current user, or a single history record
  * @param int $id (defaults to null) id of a record to fetch
  * @return array if $id is specified, then null (if not found) or a single array with keys: id, type, name, hash, contact_id, position, accessed, cnt; if no $id, then a list of such arrays is returned. */
 public function get($id = null)
 {
     if ($id) {
         $sql = "SELECT * FROM {$this->table} WHERE id=i:id";
         return $this->query($sql, array('id' => $id))->fetchRow();
     }
     $currentUserId = wa()->getUser()->getId();
     $sql = "SELECT *\n                FROM {$this->table}\n                WHERE contact_id=:uid\n                ORDER BY position, accessed DESC";
     $history = $this->query($sql, array('uid' => $currentUserId))->fetchAll();
     $contact_ids = array();
     foreach ($history as $h) {
         if ($h['type'] === 'add') {
             $contact_id = (int) str_replace('/contact/', '', $h['hash']);
             if ($contact_id) {
                 $contact_ids[] = $contact_id;
             }
         }
     }
     $contacts = array();
     if ($contact_ids) {
         $col = new contactsCollection('id/' . implode(',', $contact_ids));
         $contacts = $col->getContacts('id,is_company,photo_url_20');
     }
     foreach ($history as &$h) {
         if ($h['type'] === 'add') {
             $contact_id = (int) str_replace('/contact/', '', $h['hash']);
             $contact = ifset($contacts[$contact_id], array('is_company' => 0, 'photo_url_20' => waContact::getPhotoUrl(null, null, 20, 20, 'person')));
             $h['icon'] = $contact['photo_url_20'];
         }
     }
     unset($h);
     // leave only NUM_HISTORY_SHOW temporary items (i.e. position == 0 and type != import)
     $ra_limit = self::NUM_HISTORY_SHOW;
     // recently added
     $s_limit = self::NUM_HISTORY_SHOW;
     // search history
     $not_shown = array();
     foreach ($history as $k => $v) {
         if ($v['position'] > 0) {
             break;
         }
         if ($v['type'] != 'search') {
             if ($ra_limit <= 0) {
                 $not_shown[] = $v['id'];
                 unset($history[$k]);
                 continue;
             }
             $ra_limit--;
         } else {
             if ($s_limit <= 0) {
                 $not_shown[] = $v['id'];
                 unset($history[$k]);
                 continue;
             }
             $s_limit--;
         }
     }
     if ($not_shown) {
         $sql = "DELETE FROM {$this->table} WHERE id IN (i:id)";
         $this->exec($sql, array('id' => $not_shown));
         // reset holes in key sequence
         $history = array_merge($history);
     }
     return $history;
 }
Пример #13
0
 protected function extendContacts(&$orders)
 {
     $config = $this->getConfig();
     $use_gravatar = $config->getGeneralSettings('use_gravatar');
     $gravatar_default = $config->getGeneralSettings('gravatar_default');
     $emails = array();
     foreach ($orders as &$o) {
         if (isset($o['contact'])) {
             if (!$o['contact']['photo'] && $use_gravatar) {
                 if (!isset($emails[$o['contact']['id']])) {
                     $c = new waContact($o['contact']['id']);
                     $emails[$o['contact']['id']] = $c->get('email', 'default');
                 }
                 $email = $emails[$o['contact']['id']];
                 $o['contact']['photo_50x50'] = shopHelper::getGravatar($email, 50, $gravatar_default);
             } else {
                 $o['contact']['photo_50x50'] = waContact::getPhotoUrl($o['contact']['id'], $o['contact']['photo'], 50, 50);
             }
         } else {
             // contact deleted
             $o['contact']['name'] = isset($o['params']['contact_name']) ? $o['params']['contact_name'] : '';
             $o['contact']['name'] = htmlspecialchars($o['contact']['name']);
             $o['contact']['email'] = isset($o['params']['contact_email']) ? $o['params']['contact_email'] : '';
             $o['contact']['phone'] = isset($o['params']['contact_phone']) ? $o['params']['contact_phone'] : '';
             if ($use_gravatar) {
                 $o['contact']['photo_50x50'] = shopHelper::getGravatar($o['contact']['email'], 50, $gravatar_default);
             } else {
                 $o['contact']['photo_50x50'] = waContact::getPhotoUrl(null, null, 50, 50);
             }
         }
     }
     unset($o);
 }