Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4

Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4

Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4

Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4

Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4

Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
metadata.xml000066600000000076150773313330007062 0ustar00 router.php000066600000013507150773313330006614 0ustar00getMenu(); $params = JComponentHelper::getParams('com_contact'); $advanced = $params->get('sef_advanced_link', 0); if (empty($query['Itemid'])) { $menuItem = $menu->getActive(); } else { $menuItem = $menu->getItem($query['Itemid']); } $mView = (empty($menuItem->query['view'])) ? null : $menuItem->query['view']; $mId = (empty($menuItem->query['id'])) ? null : $menuItem->query['id']; if (isset($query['view'])) { $view = $query['view']; if (empty($query['Itemid']) || empty($menuItem) || $menuItem->component != 'com_contact') { $segments[] = $query['view']; } unset($query['view']); } // Are we dealing with a contact that is attached to a menu item? if (isset($view) && ($mView == $view) and (isset($query['id'])) and ($mId == (int) $query['id'])) { unset($query['view']); unset($query['catid']); unset($query['id']); return $segments; } if (isset($view) and ($view == 'category' or $view == 'contact')) { if ($mId != (int) $query['id'] || $mView != $view) { if ($view == 'contact' && isset($query['catid'])) { $catid = $query['catid']; } elseif (isset($query['id'])) { $catid = $query['id']; } $menuCatid = $mId; $categories = JCategories::getInstance('Contact'); $category = $categories->get($catid); if ($category) { // TODO Throw error that the category either not exists or is unpublished $path = array_reverse($category->getPath()); $array = array(); foreach ($path as $id) { if ((int) $id == (int) $menuCatid) { break; } if ($advanced) { list($tmp, $id) = explode(':', $id, 2); } $array[] = $id; } $segments = array_merge($segments, array_reverse($array)); } if ($view == 'contact') { if ($advanced) { list($tmp, $id) = explode(':', $query['id'], 2); } else { $id = $query['id']; } $segments[] = $id; } } unset($query['id']); unset($query['catid']); } if (isset($query['layout'])) { if (!empty($query['Itemid']) && isset($menuItem->query['layout'])) { if ($query['layout'] == $menuItem->query['layout']) { unset($query['layout']); } } else { if ($query['layout'] == 'default') { unset($query['layout']); } } } $total = count($segments); for ($i = 0; $i < $total; $i++) { $segments[$i] = str_replace(':', '-', $segments[$i]); } return $segments; } /** * Parse the segments of a URL. * * @param array &$segments The segments of the URL to parse. * * @return array The URL attributes to be used by the application. * * @since 3.3 */ public function parse(&$segments) { $total = count($segments); $vars = array(); for ($i = 0; $i < $total; $i++) { $segments[$i] = preg_replace('/-/', ':', $segments[$i], 1); } // Get the active menu item. $app = JFactory::getApplication(); $menu = $app->getMenu(); $item = $menu->getActive(); $params = JComponentHelper::getParams('com_contact'); $advanced = $params->get('sef_advanced_link', 0); // Count route segments $count = count($segments); // Standard routing for newsfeeds. if (!isset($item)) { $vars['view'] = $segments[0]; $vars['id'] = $segments[$count - 1]; return $vars; } // From the categories view, we can only jump to a category. $id = (isset($item->query['id']) && $item->query['id'] > 1) ? $item->query['id'] : 'root'; $contactCategory = JCategories::getInstance('Contact')->get($id); $categories = ($contactCategory) ? $contactCategory->getChildren() : array(); $vars['catid'] = $id; $vars['id'] = $id; $found = 0; foreach ($segments as $segment) { $segment = $advanced ? str_replace(':', '-', $segment) : $segment; foreach ($categories as $category) { if ($category->slug == $segment || $category->alias == $segment) { $vars['id'] = $category->id; $vars['catid'] = $category->id; $vars['view'] = 'category'; $categories = $category->getChildren(); $found = 1; break; } } if ($found == 0) { if ($advanced) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from('#__contact_details') ->where($db->quoteName('catid') . ' = ' . (int) $vars['catid']) ->where($db->quoteName('alias') . ' = ' . $db->quote($db->quote($segment))); $db->setQuery($query); $nid = $db->loadResult(); } else { $nid = $segment; } $vars['id'] = $nid; $vars['view'] = 'contact'; } $found = 0; } return $vars; } } /** * Contact router functions * * These functions are proxys for the new router interface * for old SEF extensions. * * @deprecated 4.0 Use Class based routers instead */ function ContactBuildRoute(&$query) { $router = new ContactRouter; return $router->build($query); } function ContactParseRoute($segments) { $router = new ContactRouter; return $router->parse($segments); } views/contact/view.html.php000066600000024453150773313330012003 0ustar00get('State'); $item = $this->get('Item'); $this->form = $this->get('Form'); // Get the parameters $params = JComponentHelper::getParams('com_contact'); if ($item) { // If we found an item, merge the item parameters $params->merge($item->params); // Get Category Model data $categoryModel = JModelLegacy::getInstance('Category', 'ContactModel', array('ignore_request' => true)); $categoryModel->setState('category.id', $item->catid); $categoryModel->setState('list.ordering', 'a.name'); $categoryModel->setState('list.direction', 'asc'); $categoryModel->setState('filter.published', 1); $contacts = $categoryModel->getItems(); } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); return false; } // check if access is not public $groups = $user->getAuthorisedViewLevels(); $return = ''; if ((!in_array($item->access, $groups)) || (!in_array($item->category_access, $groups))) { JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR')); return; } $options['category_id'] = $item->catid; $options['order by'] = 'a.default_con DESC, a.ordering ASC'; // Handle email cloaking if ($item->email_to && $params->get('show_email')) { $item->email_to = JHtml::_('email.cloak', $item->email_to); } if ($params->get('show_street_address') || $params->get('show_suburb') || $params->get('show_state') || $params->get('show_postcode') || $params->get('show_country')) { if (!empty ($item->address) || !empty ($item->suburb) || !empty ($item->state) || !empty ($item->country) || !empty ($item->postcode)) { $params->set('address_check', 1); } } else { $params->set('address_check', 0); } // Manage the display mode for contact detail groups switch ($params->get('contact_icons')) { case 1 : // text $params->set('marker_address', JText::_('COM_CONTACT_ADDRESS') . ": "); $params->set('marker_email', JText::_('JGLOBAL_EMAIL') . ": "); $params->set('marker_telephone', JText::_('COM_CONTACT_TELEPHONE') . ": "); $params->set('marker_fax', JText::_('COM_CONTACT_FAX') . ": "); $params->set('marker_mobile', JText::_('COM_CONTACT_MOBILE') . ": "); $params->set('marker_misc', JText::_('COM_CONTACT_OTHER_INFORMATION') . ": "); $params->set('marker_class', 'jicons-text'); break; case 2 : // none $params->set('marker_address', ''); $params->set('marker_email', ''); $params->set('marker_telephone', ''); $params->set('marker_mobile', ''); $params->set('marker_fax', ''); $params->set('marker_misc', ''); $params->set('marker_class', 'jicons-none'); break; default : if ($params->get('icon_address')) { $image1 = JHtml::_('image', $params->get('icon_address', 'con_address.png'), JText::_('COM_CONTACT_ADDRESS').": ", null, false); } else { $image1 = JHtml::_('image', 'contacts/'.$params->get('icon_address', 'con_address.png'), JText::_('COM_CONTACT_ADDRESS').": ", null, true); } if ($params->get('icon_email')) { $image2 = JHtml::_('image', $params->get('icon_email', 'emailButton.png'), JText::_('JGLOBAL_EMAIL').": ", null, false); } else { $image2 = JHtml::_('image', 'contacts/'.$params->get('icon_email', 'emailButton.png'), JText::_('JGLOBAL_EMAIL').": ", null, true); } if ($params->get('icon_telephone')) { $image3 = JHtml::_('image', $params->get('icon_telephone', 'con_tel.png'), JText::_('COM_CONTACT_TELEPHONE').": ", null, false); } else { $image3 = JHtml::_('image', 'contacts/'.$params->get('icon_telephone', 'con_tel.png'), JText::_('COM_CONTACT_TELEPHONE').": ", null, true); } if ($params->get('icon_fax')) { $image4 = JHtml::_('image', $params->get('icon_fax', 'con_fax.png'), JText::_('COM_CONTACT_FAX').": ", null, false); } else { $image4 = JHtml::_('image', 'contacts/'.$params->get('icon_fax', 'con_fax.png'), JText::_('COM_CONTACT_FAX').": ", null, true); } if ($params->get('icon_misc')) { $image5 = JHtml::_('image', $params->get('icon_misc', 'con_info.png'), JText::_('COM_CONTACT_OTHER_INFORMATION').": ", null, false); } else { $image5 = JHtml::_('image', 'contacts/'.$params->get('icon_misc', 'con_info.png'), JText::_('COM_CONTACT_OTHER_INFORMATION').": ", null, true); } if ($params->get('icon_mobile')) { $image6 = JHtml::_('image', $params->get('icon_mobile', 'con_mobile.png'), JText::_('COM_CONTACT_MOBILE').": ", null, false); } else { $image6 = JHtml::_('image', 'contacts/'.$params->get('icon_mobile', 'con_mobile.png'), JText::_('COM_CONTACT_MOBILE').": ", null, true); } $params->set('marker_address', $image1); $params->set('marker_email', $image2); $params->set('marker_telephone', $image3); $params->set('marker_fax', $image4); $params->set('marker_misc', $image5); $params->set('marker_mobile', $image6); $params->set('marker_class', 'jicons-icons'); break; } // Add links to contacts if ($params->get('show_contact_list') && count($contacts) > 1) { foreach ($contacts as &$contact) { $contact->link = JRoute::_(ContactHelperRoute::getContactRoute($contact->slug, $contact->catid)); } $item->link = JRoute::_(ContactHelperRoute::getContactRoute($item->slug, $item->catid)); } JHtml::_('behavior.formvalidation'); //Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); $this->contact = &$item; $this->params = &$params; $this->return = &$return; $this->state = &$state; $this->item = &$item; $this->user = &$user; $this->contacts = &$contacts; $item->tags = new JHelperTags; $item->tags->getItemTags('com_contact.contact', $this->item->id); // Override the layout only if this is not the active menu item // If it is the active menu item, then the view and item id will match $active = $app->getMenu()->getActive(); if ((!$active) || ((strpos($active->link, 'view=contact') === false) || (strpos($active->link, '&id=' . (string) $this->item->id) === false))) { if ($layout = $params->get('contact_layout')) { $this->setLayout($layout); } } elseif (isset($active->query['layout'])) { // We need to set the layout in case this is an alternative menu item (with an alternative layout) $this->setLayout($active->query['layout']); } $model = $this->getModel(); $model->hit(); $this->_prepareDocument(); return parent::display($tpl); } /** * Prepares the document */ protected function _prepareDocument() { $app = JFactory::getApplication(); $menus = $app->getMenu(); $pathway = $app->getPathway(); $title = null; // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } else { $this->params->def('page_heading', JText::_('COM_CONTACT_DEFAULT_PAGE_TITLE')); } $title = $this->params->get('page_title', ''); $id = (int) @$menu->query['id']; // if the menu item does not concern this contact if ($menu && ($menu->query['option'] != 'com_contact' || $menu->query['view'] != 'contact' || $id != $this->item->id)) { // If this is not a single contact menu item, set the page title to the contact title if ($this->item->name) { $title = $this->item->name; } $path = array(array('title' => $this->contact->name, 'link' => '')); $category = JCategories::getInstance('Contact')->get($this->contact->catid); while ($category && ($menu->query['option'] != 'com_contact' || $menu->query['view'] == 'contact' || $id != $category->id) && $category->id > 1) { $path[] = array('title' => $category->title, 'link' => ContactHelperRoute::getCategoryRoute($this->contact->catid)); $category = $category->getParent(); } $path = array_reverse($path); foreach ($path as $item) { $pathway->addItem($item['title'], $item['link']); } } if (empty($title)) { $title = $app->getCfg('sitename'); } elseif ($app->getCfg('sitename_pagetitles', 0) == 1) { $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename')); } if (empty($title)) { $title = $this->item->name; } $this->document->setTitle($title); if ($this->item->metadesc) { $this->document->setDescription($this->item->metadesc); } elseif (!$this->item->metadesc && $this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } if ($this->item->metakey) { $this->document->setMetadata('keywords', $this->item->metakey); } elseif (!$this->item->metakey && $this->params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } if ($this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); } $mdata = $this->item->metadata->toArray(); foreach ($mdata as $k => $v) { if ($v) { $this->document->setMetadata($k, $v); } } } } views/contact/tmpl/default_form.php000066600000006331150773313330013504 0ustar00error)) : ?>
error; ?>
form->getLabel('contact_name'); ?>
form->getInput('contact_name'); ?>
form->getLabel('contact_email'); ?>
form->getInput('contact_email'); ?>
form->getLabel('contact_subject'); ?>
form->getInput('contact_subject'); ?>
form->getLabel('contact_message'); ?>
form->getInput('contact_message'); ?>
params->get('show_email_copy')) { ?>
form->getLabel('contact_email_copy'); ?>
form->getInput('contact_email_copy'); ?>
form->getFieldsets() as $fieldset) : ?> name != 'contact'):?> form->getFieldset($fieldset->name);?>
hidden) : ?>
input;?>
label; ?> required && $field->type != "Spacer") : ?>
input;?>
views/contact/tmpl/default.php000066600000021561150773313330012463 0ustar00
params->get('show_page_heading')) : ?>

escape($this->params->get('page_heading')); ?>

contact->name && $this->params->get('show_name')) : ?> params->get('show_contact_category') == 'show_no_link') : ?>

contact->category_title; ?>

params->get('show_contact_category') == 'show_with_link') : ?> contact->catid); ?>

escape($this->contact->category_title); ?>

params->get('show_contact_list') && count($this->contacts) > 1) : ?>
contacts, 'id', 'class="inputbox" onchange="document.location.href = this.value"', 'link', 'name', $this->contact->link);?>
params->get('show_tags', 1) && !empty($this->item->tags)) : ?> item->tagLayout = new JLayoutFile('joomla.content.tags'); ?> item->tagLayout->render($this->item->tags->itemTags); ?> params->get('presentation_style') == 'sliders') : ?> 'basic-details')); ?> params->get('presentation_style') == 'tabs') : ?> 'basic-details')); ?> params->get('presentation_style') == 'sliders') : ?> params->get('presentation_style') == 'tabs') : ?> params->get('presentation_style') == 'plain'):?> '. JText::_('COM_CONTACT_DETAILS').''; ?> contact->image && $this->params->get('show_image')) : ?>
contact->image, JText::_('COM_CONTACT_IMAGE_DETAILS'), array('align' => 'middle', 'itemprop' => 'image')); ?>
contact->con_position && $this->params->get('show_position')) : ?>
contact->con_position; ?>
loadTemplate('address'); ?> params->get('allow_vcard')) : ?> params->get('presentation_style') == 'sliders') : ?> params->get('presentation_style') == 'tabs') : ?> params->get('show_email_form') && ($this->contact->email_to || $this->contact->user_id)) : ?> params->get('presentation_style') == 'sliders') : ?> params->get('presentation_style') == 'tabs') : ?> params->get('presentation_style') == 'plain'):?> '. JText::_('COM_CONTACT_EMAIL_FORM').''; ?> loadTemplate('form'); ?> params->get('presentation_style') == 'sliders') : ?> params->get('presentation_style') == 'tabs') : ?> params->get('show_links')) : ?> loadTemplate('links'); ?> params->get('show_articles') && $this->contact->user_id && $this->contact->articles) : ?> params->get('presentation_style') == 'sliders') : ?> params->get('presentation_style') == 'tabs') : ?> params->get('presentation_style') == 'plain'):?> '. JText::_('JGLOBAL_ARTICLES').''; ?> loadTemplate('articles'); ?> params->get('presentation_style') == 'sliders') : ?> params->get('presentation_style') == 'tabs') : ?> params->get('show_profile') && $this->contact->user_id && JPluginHelper::isEnabled('user', 'profile')) : ?> params->get('presentation_style') == 'sliders') : ?> params->get('presentation_style') == 'tabs') : ?> params->get('presentation_style') == 'plain'):?> '. JText::_('COM_CONTACT_PROFILE').''; ?> loadTemplate('profile'); ?> params->get('presentation_style') == 'sliders') : ?> params->get('presentation_style') == 'tabs') : ?> contact->misc && $this->params->get('show_misc')) : ?> params->get('presentation_style') == 'sliders') : ?> params->get('presentation_style') == 'tabs') : ?> params->get('presentation_style') == 'plain'):?> '. JText::_('COM_CONTACT_OTHER_INFORMATION').''; ?>
params->get('marker_misc'); ?>
contact->misc; ?>
params->get('presentation_style') == 'sliders') : ?> params->get('presentation_style') == 'tabs') : ?> params->get('presentation_style') == 'sliders') : ?> params->get('presentation_style') == 'tabs') : ?>
views/contact/tmpl/default_articles.php000066600000001400150773313330014337 0ustar00 params->get('show_articles')) : ?>
views/contact/tmpl/default_links.php000066600000003242150773313330013657 0ustar00 params->get('presentation_style') == 'sliders') : ?> params->get('presentation_style') == 'tabs') : ?> params->get('presentation_style') == 'plain'):?> '. JText::_('COM_CONTACT_LINKS').''; ?> params->get('presentation_style') == 'sliders') : ?> params->get('presentation_style') == 'tabs') : ?> views/contact/tmpl/default.xml000066600000024117150773313330012474 0ustar00
views/contact/tmpl/index.html000066600000000037150773313330012316 0ustar00 views/contact/tmpl/default_address.php000066600000007627150773313330014177 0ustar00
params->get('address_check') > 0) && ($this->contact->address || $this->contact->suburb || $this->contact->state || $this->contact->country || $this->contact->postcode)) : ?> params->get('address_check') > 0) : ?>
params->get('marker_address'); ?>
contact->address && $this->params->get('show_street_address')) : ?>
contact->address .'
'; ?>
contact->suburb && $this->params->get('show_suburb')) : ?>
contact->suburb .'
'; ?>
contact->state && $this->params->get('show_state')) : ?>
contact->state . '
'; ?>
contact->postcode && $this->params->get('show_postcode')) : ?>
contact->postcode .'
'; ?>
contact->country && $this->params->get('show_country')) : ?>
contact->country .'
'; ?>
contact->email_to && $this->params->get('show_email')) : ?>
params->get('marker_email')); ?>
contact->email_to; ?>
contact->telephone && $this->params->get('show_telephone')) : ?>
params->get('marker_telephone'); ?>
contact->telephone); ?>
contact->fax && $this->params->get('show_fax')) : ?>
params->get('marker_fax'); ?>
contact->fax); ?>
contact->mobile && $this->params->get('show_mobile')) :?>
params->get('marker_mobile'); ?>
contact->mobile); ?>
contact->webpage && $this->params->get('show_webpage')) : ?>
views/contact/tmpl/default_profile.php000066600000002234150773313330014177 0ustar00 item->profile->getFieldset('profile'); ?>
value) : echo '
' . $profile->label . '
'; $profile->text = htmlspecialchars($profile->value, ENT_COMPAT, 'UTF-8'); switch ($profile->id) : case "profile_website": $v_http = substr($profile->value, 0, 4); if ($v_http == "http") : echo '
' . $profile->text . '
'; else : echo '
' . $profile->text . '
'; endif; break; default: echo '
' . $profile->text . '
'; break; endswitch; endif; endforeach; ?>
views/contact/metadata.xml000066600000000230150773313330011642 0ustar00 views/contact/index.html000066600000000037150773313330011342 0ustar00 views/contact/view.vcf.php000066600000005662150773313330011616 0ustar00get('Item'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); return false; } JFactory::getDocument()->setMetaData('Content-Type', 'text/directory', true); // Compute lastname, firstname and middlename $item->name = trim($item->name); // "Lastname, Firstname Midlename" format support // e.g. "de Gaulle, Charles" $namearray = explode(',', $item->name); if (count($namearray) > 1 ) { $lastname = $namearray[0]; $card_name = $lastname; $name_and_midname = trim($namearray[1]); $firstname = ''; if (!empty($name_and_midname)) { $namearray = explode(' ', $name_and_midname); $firstname = $namearray[0]; $middlename = (count($namearray) > 1) ? $namearray[1] : ''; $card_name = $firstname . ' ' . ($middlename ? $middlename . ' ' : '') . $card_name; } } // "Firstname Middlename Lastname" format support else { $namearray = explode(' ', $item->name); $middlename = (count($namearray) > 2) ? $namearray[1] : ''; $firstname = array_shift($namearray); $lastname = count($namearray) ? end($namearray) : ''; $card_name = $firstname . ($middlename ? ' ' . $middlename : '') . ($lastname ? ' ' . $lastname : ''); } $rev = date('c', strtotime($item->modified)); JFactory::getApplication()->setHeader('Content-disposition', 'attachment; filename="'.$card_name.'.vcf"', true); $vcard = array(); $vcard[] .= 'BEGIN:VCARD'; $vcard[] .= 'VERSION:3.0'; $vcard[] = 'N:'.$lastname.';'.$firstname.';'.$middlename; $vcard[] = 'FN:'. $item->name; $vcard[] = 'TITLE:'.$item->con_position; $vcard[] = 'TEL;TYPE=WORK,VOICE:'.$item->telephone; $vcard[] = 'TEL;TYPE=WORK,FAX:'.$item->fax; $vcard[] = 'TEL;TYPE=WORK,MOBILE:'.$item->mobile; $vcard[] = 'ADR;TYPE=WORK:;;'.$item->address.';'.$item->suburb.';'.$item->state.';'.$item->postcode.';'.$item->country; $vcard[] = 'LABEL;TYPE=WORK:'.$item->address."\n".$item->suburb."\n".$item->state."\n".$item->postcode."\n".$item->country; $vcard[] = 'EMAIL;TYPE=PREF,INTERNET:'.$item->email_to; $vcard[] = 'URL:'.$item->webpage; $vcard[] = 'REV:'.$rev.'Z'; $vcard[] = 'END:VCARD'; echo implode("\n", $vcard); } } views/featured/view.html.php000066600000007046150773313330012146 0ustar00getParams(); // Get some data from the models $state = $this->get('State'); $items = $this->get('Items'); $category = $this->get('Category'); $children = $this->get('Children'); $parent = $this->get('Parent'); $pagination = $this->get('Pagination'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); return false; } // Prepare the data. // Compute the contact slug. for ($i = 0, $n = count($items); $i < $n; $i++) { $item = &$items[$i]; $item->slug = $item->alias ? ($item->id.':'.$item->alias) : $item->id; $temp = new JRegistry; $temp->loadString($item->params); $item->params = clone($params); $item->params->merge($temp); if ($item->params->get('show_email', 0) == 1) { $item->email_to = trim($item->email_to); if (!empty($item->email_to) && JMailHelper::isEmailAddress($item->email_to)) { $item->email_to = JHtml::_('email.cloak', $item->email_to); } else { $item->email_to = ''; } } } // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); $maxLevel = $params->get('maxLevel', -1); $this->maxLevel = &$maxLevel; $this->state = &$state; $this->items = &$items; $this->category = &$category; $this->children = &$children; $this->params = &$params; $this->parent = &$parent; $this->pagination = &$pagination; $this->_prepareDocument(); parent::display($tpl); } /** * Prepares the document */ protected function _prepareDocument() { $app = JFactory::getApplication(); $menus = $app->getMenu(); $title = null; // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); } else { $this->params->def('page_heading', JText::_('COM_CONTACT_DEFAULT_PAGE_TITLE')); } $title = $this->params->get('page_title', ''); if (empty($title)) { $title = $app->getCfg('sitename'); } elseif ($app->getCfg('sitename_pagetitles', 0) == 1) { $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename')); } $this->document->setTitle($title); if ($this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } if ($this->params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } if ($this->params->get('robots')) { $this->document->setMetadata('robots', $this->params->get('robots')); } } } views/featured/tmpl/default.php000066600000002173150773313330012625 0ustar00
params->get('show_page_heading') != 0 ) : ?>

escape($this->params->get('page_heading')); ?>

loadTemplate('items'); ?> params->def('show_pagination', 2) == 1 || ($this->params->get('show_pagination') == 2 && $this->pagination->pagesTotal > 1)) : ?>
views/featured/tmpl/default.xml000066600000030041150773313330012631 0ustar00
views/featured/tmpl/index.html000066600000000037150773313330012462 0ustar00 views/featured/tmpl/default_items.php000066600000012772150773313330014034 0ustar00escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); // Create a shortcut for params. $params = &$this->item->params; ?> items)) : ?>

params->get('show_pagination_limit')) : ?>
  pagination->getLimitBox(); ?>
params->get('show_headings')) : ?> params->get('show_position_headings')) : ?> params->get('show_email_headings')) : ?> params->get('show_telephone_headings')) : ?> params->get('show_mobile_headings')) : ?> params->get('show_fax_headings')) : ?> params->get('show_suburb_headings')) : ?> params->get('show_state_headings')) : ?> params->get('show_country_headings')) : ?> items as $i => $item) : ?> " itemscope itemtype="http://schema.org/Person"> params->get('show_position_headings')) : ?> params->get('show_email_headings')) : ?> params->get('show_telephone_headings')) : ?> params->get('show_mobile_headings')) : ?> params->get('show_fax_headings')) : ?> params->get('show_suburb_headings')) : ?> params->get('show_state_headings')) : ?> params->get('show_country_headings')) : ?>
items[$i]->published == 0) : ?> con_position; ?> telephone; ?> mobile; ?> fax; ?> suburb; ?> state; ?> country; ?>
views/featured/metadata.xml000066600000000234150773313330012012 0ustar00 views/featured/index.html000066600000000037150773313330011506 0ustar00 views/index.html000066600000000037150773313330007707 0ustar00 views/categories/view.html.php000066600000001320150773313330012461 0ustar00loadTemplate('items'); ?> views/categories/tmpl/default.xml000066600000043770150773313330013174 0ustar00
views/categories/tmpl/index.html000066600000000037150773313330013010 0ustar00 views/categories/tmpl/default_items.php000066600000004233150773313330014353 0ustar00items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) : ?> items[$this->parent->id] as $id => $item) : ?> params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) : if (!isset($this->items[$this->parent->id][$id + 1])) { $class = ' class="last"'; } ?>
> params->get('show_subcat_desc_cat') == 1) :?> description) : ?>
description, '', 'com_contact.categories'); ?>
getChildren()) > 0) :?>
items[$item->id] = $item->getChildren(); $this->parent = $item; $this->maxLevelcat--; echo $this->loadTemplate('items'); $this->parent = $item->getParent(); $this->maxLevelcat++; ?>
views/categories/index.html000066600000000037150773313330012034 0ustar00 views/category/view.html.php000066600000005277150773313330012170 0ustar00items as $item) { $item->slug = $item->alias ? ($item->id.':'.$item->alias) : $item->id; $temp = new JRegistry; $temp->loadString($item->params); $item->params = clone($this->params); $item->params->merge($temp); if ($item->params->get('show_email', 0) == 1) { $item->email_to = trim($item->email_to); if (!empty($item->email_to) && JMailHelper::isEmailAddress($item->email_to)) { $item->email_to = JHtml::_('email.cloak', $item->email_to); } else { $item->email_to = ''; } } } return parent::display($tpl); } /** * Prepares the document * * @return void */ protected function prepareDocument() { parent::prepareDocument(); $menu = $this->menu; $id = (int) @$menu->query['id']; if ($menu && ($menu->query['option'] != $this->extension || $menu->query['view'] == $this->viewName || $id != $this->category->id)) { $path = array(array('title' => $this->category->title, 'link' => '')); $category = $this->category->getParent(); while (($menu->query['option'] != 'com_contact' || $menu->query['view'] == 'contact' || $id != $category->id) && $category->id > 1) { $path[] = array('title' => $category->title, 'link' => ContactHelperRoute::getCategoryRoute($category->id)); $category = $category->getParent(); } $path = array_reverse($path); foreach ($path as $item) { $this->pathway->addItem($item['title'], $item['link']); } } parent::addFeed(); } } views/category/tmpl/default.php000066600000000565150773313330012646 0ustar00subtemplatename = 'items'; echo JLayoutHelper::render('joomla.content.category_default', $this); views/category/tmpl/default.xml000066600000041226150773313330012656 0ustar00
views/category/tmpl/index.html000066600000000037150773313330012500 0ustar00 views/category/tmpl/default_children.php000066600000003406150773313330014513 0ustar00children[$this->category->id]) > 0 && $this->maxLevel != 0) : ?> views/category/tmpl/default_items.php000066600000010757150773313330014053 0ustar00escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> items)) : ?>

params->get('filter_field') != 'hide' || $this->params->get('show_pagination_limit')) :?>
params->get('filter_field') != 'hide') :?>
params->get('show_pagination_limit')) : ?>
pagination->getLimitBox(); ?>
params->get('show_pagination')) : ?>
views/category/metadata.xml000066600000000242150773313330012027 0ustar00 views/category/index.html000066600000000037150773313330011524 0ustar00 views/category/view.feed.php000066600000001733150773313330012120 0ustar00description = $item->address; } } index.html000066600000000037150773313330006552 0ustar00 contact.php000066600000000733150773313330006724 0ustar00execute(JFactory::getApplication()->input->get('task')); $controller->redirect(); controller.php000066600000002600150773313330007447 0ustar00input->get('view', 'categories'); $this->input->set('view', $vName); $safeurlparams = array('catid' => 'INT', 'id' => 'INT', 'cid' => 'ARRAY', 'year' => 'INT', 'month' => 'INT', 'limit' => 'UINT', 'limitstart' => 'UINT', 'showall' => 'INT', 'return' => 'BASE64', 'filter' => 'STRING', 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'filter-search' => 'STRING', 'print' => 'BOOLEAN', 'lang' => 'CMD'); parent::display($cachable, $safeurlparams); return $this; } } controllers/index.html000066600000000037150773313330011120 0ustar00 controllers/contact.php000066600000012335150773313330011273 0ustar00 true)) { return parent::getModel($name, $prefix, array('ignore_request' => false)); } public function submit() { // Check for request forgeries. JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); $model = $this->getModel('contact'); $params = JComponentHelper::getParams('com_contact'); $stub = $this->input->getString('id'); $id = (int) $stub; // Get the data from POST $data = $this->input->post->get('jform', array(), 'array'); $contact = $model->getItem($id); $params->merge($contact->params); // Check for a valid session cookie if ($params->get('validate_session', 0)) { if (JFactory::getSession()->getState() != 'active'){ JError::raiseWarning(403, JText::_('COM_CONTACT_SESSION_INVALID')); // Save the data in the session. $app->setUserState('com_contact.contact.data', $data); // Redirect back to the contact form. $this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id='.$stub, false)); return false; } } // Contact plugins JPluginHelper::importPlugin('contact'); $dispatcher = JEventDispatcher::getInstance(); // Validate the posted data. $form = $model->getForm(); if (!$form) { JError::raiseError(500, $model->getError()); return false; } $validate = $model->validate($form, $data); if ($validate === false) { // Get the validation messages. $errors = $model->getErrors(); // Push up to three validation messages out to the user. for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) { if ($errors[$i] instanceof Exception) { $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); } else { $app->enqueueMessage($errors[$i], 'warning'); } } // Save the data in the session. $app->setUserState('com_contact.contact.data', $data); // Redirect back to the contact form. $this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id='.$stub, false)); return false; } // Validation succeeded, continue with custom handlers $results = $dispatcher->trigger('onValidateContact', array(&$contact, &$data)); foreach ($results as $result) { if ($result instanceof Exception) { return false; } } // Passed Validation: Process the contact plugins to integrate with other applications $dispatcher->trigger('onSubmitContact', array(&$contact, &$data)); // Send the email $sent = false; if (!$params->get('custom_reply')) { $sent = $this->_sendEmail($data, $contact); } // Set the success message if it was a success if (!($sent instanceof Exception)) { $msg = JText::_('COM_CONTACT_EMAIL_THANKS'); } else { $msg = ''; } // Flush the data from the session $app->setUserState('com_contact.contact.data', null); // Redirect if it is set in the parameters, otherwise redirect back to where we came from if ($contact->params->get('redirect')) { $this->setRedirect($contact->params->get('redirect'), $msg); } else { $this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id='.$stub, false), $msg); } return true; } private function _sendEmail($data, $contact) { $app = JFactory::getApplication(); if ($contact->email_to == '' && $contact->user_id != 0) { $contact_user = JUser::getInstance($contact->user_id); $contact->email_to = $contact_user->get('email'); } $mailfrom = $app->getCfg('mailfrom'); $fromname = $app->getCfg('fromname'); $sitename = $app->getCfg('sitename'); $name = $data['contact_name']; $email = JStringPunycode::emailToPunycode($data['contact_email']); $subject = $data['contact_subject']; $body = $data['contact_message']; // Prepare email body $prefix = JText::sprintf('COM_CONTACT_ENQUIRY_TEXT', JUri::base()); $body = $prefix."\n".$name.' <'.$email.'>'."\r\n\r\n".stripslashes($body); $mail = JFactory::getMailer(); $mail->addRecipient($contact->email_to); $mail->addReplyTo(array($email, $name)); $mail->setSender(array($mailfrom, $fromname)); $mail->setSubject($sitename.': '.$subject); $mail->setBody($body); $sent = $mail->Send(); //If we are supposed to copy the sender, do so. // check whether email copy function activated if ( array_key_exists('contact_email_copy', $data) ) { $copytext = JText::sprintf('COM_CONTACT_COPYTEXT_OF', $contact->name, $sitename); $copytext .= "\r\n\r\n".$body; $copysubject = JText::sprintf('COM_CONTACT_COPYSUBJECT_OF', $subject); $mail = JFactory::getMailer(); $mail->addRecipient($email); $mail->addReplyTo(array($email, $name)); $mail->setSender(array($mailfrom, $fromname)); $mail->setSubject($copysubject); $mail->setBody($copytext); $sent = $mail->Send(); } return $sent; } } helpers/association.php000066600000003331150773313330011244 0ustar00input; $view = is_null($view) ? $jinput->get('view') : $view; $id = empty($id) ? $jinput->getInt('id') : $id; if ($view == 'contact') { if ($id) { $associations = JLanguageAssociations::getAssociations('com_contact', '#__contact_details', 'com_contact.item', $id); $return = array(); foreach ($associations as $tag => $item) { $return[$tag] = ContactHelperRoute::getContactRoute($item->id, $item->catid, $item->language); } return $return; } } if ($view == 'category' || $view == 'categories') { return self::getCategoryAssociations($id, 'com_contact'); } return array(); } } helpers/index.html000066600000000037150773313330010214 0ustar00 helpers/icon.php000066600000005367150773313330007673 0ustar00toString(array('scheme', 'host', 'port')); $link = $base . JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catid), false); $url = 'index.php?option=com_mailto&tmpl=component&link='.MailToHelper::addLink($link); $status = 'width=400,height=350,menubar=yes,resizable=yes'; if ($params->get('show_icons')) { $text = JHtml::_('image', 'system/emailButton.png', JText::_('JGLOBAL_EMAIL'), null, true); } else { $text = ' '.JText::_('JGLOBAL_EMAIL'); } $attribs['title'] = JText::_('JGLOBAL_EMAIL'); $attribs['onclick'] = "window.open(this.href,'win2','".$status."'); return false;"; $output = JHtml::_('link', JRoute::_($url), $text, $attribs); return $output; } public static function print_popup($article, $params, $attribs = array()) { $url = ContentHelperRoute::getContactRoute($contact->slug, $contact->catid); $url .= '&tmpl=component&print=1&layout=default&page='.@ $request->limitstart; $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no'; // checks template image directory for image, if non found default are loaded if ($params->get('show_icons')) { $text = JHtml::_('image', 'system/printButton.png', JText::_('JGLOBAL_PRINT'), null, true); } else { $text = JText::_('JGLOBAL_ICON_SEP') .' '. JText::_('JGLOBAL_PRINT') .' '. JText::_('JGLOBAL_ICON_SEP'); } $attribs['title'] = JText::_('JGLOBAL_PRINT'); $attribs['onclick'] = "window.open(this.href,'win2','".$status."'); return false;"; $attribs['rel'] = 'nofollow'; return JHtml::_('link', JRoute::_($url), $text, $attribs); } public static function print_screen($contact, $params, $attribs = array()) { // checks template image directory for image, if non found default are loaded if ($params->get('show_icons')) { $text = JHtml::_('image', 'system/printButton.png', JText::_('JGLOBAL_PRINT'), null, true); } else { $text = JText::_('JGLOBAL_ICON_SEP') .' '. JText::_('JGLOBAL_PRINT') .' '. JText::_('JGLOBAL_ICON_SEP'); } return ''.$text.''; } } helpers/category.php000066600000001214150773313330010543 0ustar00 array((int) $id) ); //Create the link $link = 'index.php?option=com_contact&view=contact&id='. $id; if ($catid > 1) { $categories = JCategories::getInstance('Contact'); $category = $categories->get($catid); if ($category) { $needles['category'] = array_reverse($category->getPath()); $needles['categories'] = $needles['category']; $link .= '&catid='.$catid; } } if ($language && $language != "*" && JLanguageMultilang::isEnabled()) { self::buildLanguageLookup(); if (isset(self::$lang_lookup[$language])) { $link .= '&lang='.self::$lang_lookup[$language]; $needles['language'] = $language; } } if ($item = self::_findItem($needles)) { $link .= '&Itemid='.$item; } return $link; } public static function getCategoryRoute($catid, $language = 0) { if ($catid instanceof JCategoryNode) { $id = $catid->id; $category = $catid; } else { $id = (int) $catid; $category = JCategories::getInstance('Contact')->get($id); } if ($id < 1 || !($category instanceof JCategoryNode)) { $link = ''; } else { $needles = array(); // Create the link $link = 'index.php?option=com_contact&view=category&id=' . $id; $catids = array_reverse($category->getPath()); $needles['category'] = $catids; $needles['categories'] = $catids; if ($language && $language != "*" && JLanguageMultilang::isEnabled()) { self::buildLanguageLookup(); if (isset(self::$lang_lookup[$language])) { $link .= '&lang=' . self::$lang_lookup[$language]; $needles['language'] = $language; } } if ($item = self::_findItem($needles)) { $link .= '&Itemid='.$item; } } return $link; } protected static function buildLanguageLookup() { if (count(self::$lang_lookup) == 0) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('a.sef AS sef') ->select('a.lang_code AS lang_code') ->from('#__languages AS a'); $db->setQuery($query); $langs = $db->loadObjectList(); foreach ($langs as $lang) { self::$lang_lookup[$lang->lang_code] = $lang->sef; } } } protected static function _findItem($needles = null) { $app = JFactory::getApplication(); $menus = $app->getMenu('site'); $language = isset($needles['language']) ? $needles['language'] : '*'; // Prepare the reverse lookup array. if (!isset(self::$lookup[$language])) { self::$lookup[$language] = array(); $component = JComponentHelper::getComponent('com_contact'); $attributes = array('component_id'); $values = array($component->id); if ($language != '*') { $attributes[] = 'language'; $values[] = array($needles['language'], '*'); } $items = $menus->getItems($attributes, $values); foreach ($items as $item) { if (isset($item->query) && isset($item->query['view'])) { $view = $item->query['view']; if (!isset(self::$lookup[$language][$view])) { self::$lookup[$language][$view] = array(); } if (isset($item->query['id'])) { // here it will become a bit tricky // language != * can override existing entries // language == * cannot override existing entries if (!isset(self::$lookup[$language][$view][$item->query['id']]) || $item->language != '*') { self::$lookup[$language][$view][$item->query['id']] = $item->id; } } } } } if ($needles) { foreach ($needles as $view => $ids) { if (isset(self::$lookup[$language][$view])) { foreach ($ids as $id) { if (isset(self::$lookup[$language][$view][(int) $id])) { return self::$lookup[$language][$view][(int) $id]; } } } } } // Check if the active menuitem matches the requested language $active = $menus->getActive(); if ($active && ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled())) { return $active->id; } // If not found, return language specific home link $default = $menus->getDefault($language); return !empty($default->id) ? $default->id : null; } } models/index.html000066600000000037150773313330010035 0ustar00 models/contact.php000066600000027516150773313330010217 0ustar00input->getInt('id'); $this->setState('contact.id', $pk); // Load the parameters. $params = $app->getParams(); $this->setState('params', $params); $user = JFactory::getUser(); if ((!$user->authorise('core.edit.state', 'com_contact')) && (!$user->authorise('core.edit', 'com_contact'))){ $this->setState('filter.published', 1); $this->setState('filter.archived', 2); } } /** * Method to get the contact form. * * The base form is loaded from XML and then an event is fired * * * @param array $data An optional array of data for the form to interrogate. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * @return JForm A JForm object on success, false on failure * @since 1.6 */ public function getForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm('com_contact.contact', 'contact', array('control' => 'jform', 'load_data' => true)); if (empty($form)) { return false; } $id = $this->getState('contact.id'); $params = $this->getState('params'); $contact = $this->_item[$id]; $params->merge($contact->params); if (!$params->get('show_email_copy', 0)){ $form->removeField('contact_email_copy'); } return $form; } protected function loadFormData() { $data = (array) JFactory::getApplication()->getUserState('com_contact.contact.data', array()); $this->preprocessData('com_contact.contact', $data); return $data; } /** * Gets a contact * * @param integer $pk Id for the contact * * @return mixed Object or null */ public function &getItem($pk = null) { $pk = (!empty($pk)) ? $pk : (int) $this->getState('contact.id'); if ($this->_item === null) { $this->_item = array(); } if (!isset($this->_item[$pk])) { try { $db = $this->getDbo(); $query = $db->getQuery(true); //sqlsrv changes $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias', '!=', '0'); $case_when .= ' THEN '; $a_id = $query->castAsChar('a.id'); $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':'); $case_when .= ' ELSE '; $case_when .= $a_id.' END as slug'; $case_when1 = ' CASE WHEN '; $case_when1 .= $query->charLength('c.alias', '!=', '0'); $case_when1 .= ' THEN '; $c_id = $query->castAsChar('c.id'); $case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':'); $case_when1 .= ' ELSE '; $case_when1 .= $c_id.' END as catslug'; $query->select($this->getState('item.select', 'a.*') . ','.$case_when.','.$case_when1) ->from('#__contact_details AS a') // Join on category table. ->select('c.title AS category_title, c.alias AS category_alias, c.access AS category_access') ->join('LEFT', '#__categories AS c on c.id = a.catid') // Join over the categories to get parent category titles ->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias') ->join('LEFT', '#__categories as parent ON parent.id = c.parent_id') ->where('a.id = ' . (int) $pk); // Filter by start and end dates. $nullDate = $db->quote($db->getNullDate()); $nowDate = $db->quote(JFactory::getDate()->toSql()); // Filter by published state. $published = $this->getState('filter.published'); $archived = $this->getState('filter.archived'); if (is_numeric($published)) { $query->where('(a.published = ' . (int) $published . ' OR a.published =' . (int) $archived . ')') ->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')') ->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')'); } $db->setQuery($query); $data = $db->loadObject(); if (empty($data)) { JError::raiseError(404, JText::_('COM_CONTACT_ERROR_CONTACT_NOT_FOUND')); } // Check for published state if filter set. if (((is_numeric($published)) || (is_numeric($archived))) && (($data->published != $published) && ($data->published != $archived))) { JError::raiseError(404, JText::_('COM_CONTACT_ERROR_CONTACT_NOT_FOUND')); } // Convert parameter fields to objects. $registry = new JRegistry; $registry->loadString($data->params); $data->params = clone $this->getState('params'); $data->params->merge($registry); $registry = new JRegistry; $registry->loadString($data->metadata); $data->metadata = $registry; $data->tags = new JHelperTags; $data->tags->getItemTags('com_contact.contact', $data->id); // Compute access permissions. if ($access = $this->getState('filter.access')) { // If the access filter has been set, we already know this user can view. $data->params->set('access-view', true); } else { // If no access filter is set, the layout takes some responsibility for display of limited information. $user = JFactory::getUser(); $groups = $user->getAuthorisedViewLevels(); if ($data->catid == 0 || $data->category_access === null) { $data->params->set('access-view', in_array($data->access, $groups)); } else { $data->params->set('access-view', in_array($data->access, $groups) && in_array($data->category_access, $groups)); } } $this->_item[$pk] = $data; } catch (Exception $e) { $this->setError($e); $this->_item[$pk] = false; } } if ($this->_item[$pk]) { if ($extendedData = $this->getContactQuery($pk)) { $this->_item[$pk]->articles = $extendedData->articles; $this->_item[$pk]->profile = $extendedData->profile; } } return $this->_item[$pk]; } protected function getContactQuery($pk = null) { // TODO: Cache on the fingerprint of the arguments $db = $this->getDbo(); $nullDate = $db->quote($db->getNullDate()); $nowDate = $db->quote(JFactory::getDate()->toSql()); $user = JFactory::getUser(); $pk = (!empty($pk)) ? $pk : (int) $this->getState('contact.id'); $query = $db->getQuery(true); if ($pk) { //sqlsrv changes $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias', '!=', '0'); $case_when .= ' THEN '; $a_id = $query->castAsChar('a.id'); $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':'); $case_when .= ' ELSE '; $case_when .= $a_id.' END as slug'; $case_when1 = ' CASE WHEN '; $case_when1 .= $query->charLength('cc.alias', '!=', '0'); $case_when1 .= ' THEN '; $c_id = $query->castAsChar('cc.id'); $case_when1 .= $query->concatenate(array($c_id, 'cc.alias'), ':'); $case_when1 .= ' ELSE '; $case_when1 .= $c_id.' END as catslug'; $query->select( 'a.*, cc.access as category_access, cc.title as category_name, ' . $case_when . ',' . $case_when1 ) ->from('#__contact_details AS a') ->join('INNER', '#__categories AS cc on cc.id = a.catid') ->where('a.id = ' . (int) $pk); $published = $this->getState('filter.published'); if (is_numeric($published)) { $query->where('a.published IN (1,2)') ->where('cc.published IN (1,2)'); } $groups = implode(',', $user->getAuthorisedViewLevels()); $query->where('a.access IN ('.$groups.')'); try { $db->setQuery($query); $result = $db->loadObject(); if (empty($result)) { throw new Exception(JText::_('COM_CONTACT_ERROR_CONTACT_NOT_FOUND'), 404); } // If we are showing a contact list, then the contact parameters take priority // So merge the contact parameters with the merged parameters if ($this->getState('params')->get('show_contact_list')) { $registry = new JRegistry; $registry->loadString($result->params); $this->getState('params')->merge($registry); } } catch (Exception $e) { $this->setError($e); return false; } if ($result) { $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); //get the content by the linked user $query = $db->getQuery(true) ->select('a.id') ->select('a.title') ->select('a.state') ->select('a.access') ->select('a.created'); // SQL Server changes $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias', '!=', '0'); $case_when .= ' THEN '; $a_id = $query->castAsChar('a.id'); $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':'); $case_when .= ' ELSE '; $case_when .= $a_id.' END as slug'; $case_when1 = ' CASE WHEN '; $case_when1 .= $query->charLength('c.alias', '!=', '0'); $case_when1 .= ' THEN '; $c_id = $query->castAsChar('c.id'); $case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':'); $case_when1 .= ' ELSE '; $case_when1 .= $c_id.' END as catslug'; $query->select($case_when1 . ',' . $case_when) ->from('#__content as a') ->join('LEFT', '#__categories as c on a.catid=c.id') ->where('a.created_by = ' . (int) $result->user_id) ->where('a.access IN ('. $groups.')') ->order('a.state DESC, a.created DESC'); // filter per language if plugin published if (JLanguageMultilang::isEnabled()) { $query->where(('a.created_by = ' . (int) $result->user_id) . ' AND ' . ('a.language=' . $db->quote(JFactory::getLanguage()->getTag()) . ' OR a.language=' . $db->quote('*'))); } if (is_numeric($published)) { $query->where('a.state IN (1,2)') ->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')') ->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')'); } $db->setQuery($query, 0, 10); $articles = $db->loadObjectList(); $result->articles = $articles; //get the profile information for the linked user require_once JPATH_ADMINISTRATOR.'/components/com_users/models/user.php'; $userModel = JModelLegacy::getInstance('User', 'UsersModel', array('ignore_request' => true)); $data = $userModel->getItem((int) $result->user_id); JPluginHelper::importPlugin('user'); $form = new JForm('com_users.profile'); // Get the dispatcher. $dispatcher = JEventDispatcher::getInstance(); // Trigger the form preparation event. $dispatcher->trigger('onContentPrepareForm', array($form, $data)); // Trigger the data preparation event. $dispatcher->trigger('onContentPrepareData', array('com_users.profile', $data)); // Load the data into the form after the plugins have operated. $form->bind($data); $result->profile = $form; $this->contact = $result; return $result; } } } /** * Increment the hit counter for the contact. * * @param integer $pk Optional primary key of the contact to increment. * * @return boolean True if successful; false otherwise and internal error set. * * @since 3.0 */ public function hit($pk = 0) { $input = JFactory::getApplication()->input; $hitcount = $input->getInt('hitcount', 1); if ($hitcount) { $pk = (!empty($pk)) ? $pk : (int) $this->getState('contact.id'); $table = JTable::getInstance('Contact', 'ContactTable'); $table->load($pk); $table->hit($pk); } return true; } } models/featured.php000066600000013731150773313330010355 0ustar00_params)) { $params = new JRegistry; $params->loadString($item->params); $item->params = $params; } } return $items; } /** * Method to build an SQL query to load the list data. * * @return string An SQL query * @since 1.6 */ protected function getListQuery() { $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); // Select required fields from the categories. $query->select($this->getState('list.select', 'a.*')) ->from($db->quoteName('#__contact_details') . ' AS a') ->where('a.access IN (' . $groups . ')') ->where('a.featured=1') ->join('INNER', '#__categories AS c ON c.id = a.catid') ->where('c.access IN (' . $groups . ')'); // Filter by category. if ($categoryId = $this->getState('category.id')) { $query->where('a.catid = ' . (int) $categoryId); } //sqlsrv change... aliased c.published to cat_published // Join to check for category published state in parent categories up the tree $query->select('c.published as cat_published, CASE WHEN badcats.id is null THEN c.published ELSE 0 END AS parents_published'); $subquery = 'SELECT cat.id as id FROM #__categories AS cat JOIN #__categories AS parent '; $subquery .= 'ON cat.lft BETWEEN parent.lft AND parent.rgt '; $subquery .= 'WHERE parent.extension = ' . $db->quote('com_contact'); // Find any up-path categories that are not published // If all categories are published, badcats.id will be null, and we just use the contact state $subquery .= ' AND parent.published != 1 GROUP BY cat.id '; // Select state to unpublished if up-path category is unpublished $publishedWhere = 'CASE WHEN badcats.id is null THEN a.published ELSE 0 END'; $query->join('LEFT OUTER', '(' . $subquery . ') AS badcats ON badcats.id = c.id'); // Filter by state $state = $this->getState('filter.published'); if (is_numeric($state)) { $query->where('a.published = ' . (int) $state); // Filter by start and end dates. $nullDate = $db->quote($db->getNullDate()); $date = JFactory::getDate(); $nowDate = $db->quote($date->toSql()); $query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')') ->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')') ->where($publishedWhere . ' = ' . (int) $state); } // Filter by language if ($this->getState('filter.language')) { $query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')'); } // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'a.ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); return $query; } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication(); $params = JComponentHelper::getParams('com_contact'); // List state information $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'uint'); $this->setState('list.limit', $limit); $limitstart = $app->input->get('limitstart', 0, 'uint'); $this->setState('list.start', $limitstart); $orderCol = $app->input->get('filter_order', 'ordering'); if (!in_array($orderCol, $this->filter_fields)) { $orderCol = 'ordering'; } $this->setState('list.ordering', $orderCol); $listOrder = $app->input->get('filter_order_Dir', 'ASC'); if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) { $listOrder = 'ASC'; } $this->setState('list.direction', $listOrder); $user = JFactory::getUser(); if ((!$user->authorise('core.edit.state', 'com_contact')) && (!$user->authorise('core.edit', 'com_contact'))) { // Limit to published for people who can't edit or edit.state. $this->setState('filter.published', 1); // Filter by start and end dates. $this->setState('filter.publish_date', true); } $this->setState('filter.language', JLanguageMultilang::isEnabled()); // Load the parameters. $this->setState('params', $params); } } models/forms/contact.xml000066600000003103150773313330011340 0ustar00
models/forms/index.html000066600000000037150773313330011163 0ustar00 models/forms/form.xml000066600000034114150773313330010656 0ustar00
models/categories.php000066600000005725150773313330010707 0ustar00setState('filter.extension', $this->_extension); // Get the parent id if defined. $parentId = $app->input->getInt('id'); $this->setState('filter.parentId', $parentId); $params = $app->getParams(); $this->setState('params', $params); $this->setState('filter.published', 1); $this->setState('filter.access', true); } /** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string $id A prefix for the store id. * * @return string A store id. */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':'.$this->getState('filter.extension'); $id .= ':'.$this->getState('filter.published'); $id .= ':'.$this->getState('filter.access'); $id .= ':'.$this->getState('filter.parentId'); return parent::getStoreId($id); } /** * redefine the function an add some properties to make the styling more easy * * @return mixed An array of data items on success, false on failure. */ public function getItems() { if (!count($this->_items)) { $app = JFactory::getApplication(); $menu = $app->getMenu(); $active = $menu->getActive(); $params = new JRegistry; if ($active) { $params->loadString($active->params); } $options = array(); $options['countItems'] = $params->get('show_cat_items_cat', 1) || !$params->get('show_empty_categories_cat', 0); $categories = JCategories::getInstance('Contact', $options); $this->_parent = $categories->get($this->getState('filter.parentId', 'root')); if (is_object($this->_parent)) { $this->_items = $this->_parent->getChildren(); } else { $this->_items = false; } } return $this->_items; } public function getParent() { if (!is_object($this->_parent)) { $this->getItems(); } return $this->_parent; } } models/category.php000066600000024570150773313330010376 0ustar00_params)) { $params = new JRegistry; $params->loadString($item->params); $item->params = $params; } $this->tags = new JHelperTags; $this->tags->getItemTags('com_contact.contact', $item->id); } return $items; } /** * Method to build an SQL query to load the list data. * * @return string An SQL query * @since 1.6 */ protected function getListQuery() { $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); // Select required fields from the categories. //sqlsrv changes $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias', '!=', '0'); $case_when .= ' THEN '; $a_id = $query->castAsChar('a.id'); $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':'); $case_when .= ' ELSE '; $case_when .= $a_id . ' END as slug'; $case_when1 = ' CASE WHEN '; $case_when1 .= $query->charLength('c.alias', '!=', '0'); $case_when1 .= ' THEN '; $c_id = $query->castAsChar('c.id'); $case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':'); $case_when1 .= ' ELSE '; $case_when1 .= $c_id . ' END as catslug'; $query->select($this->getState('list.select', 'a.*') . ',' . $case_when . ',' . $case_when1) // TODO: we actually should be doing it but it's wrong this way // . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, ' // . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END AS catslug '); ->from($db->quoteName('#__contact_details') . ' AS a') ->join('LEFT', '#__categories AS c ON c.id = a.catid') ->where('a.access IN (' . $groups . ')'); // Filter by category. if ($categoryId = $this->getState('category.id')) { $query->where('a.catid = ' . (int) $categoryId) ->where('c.access IN (' . $groups . ')'); } // Join over the users for the author and modified_by names. $query->select("CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author") ->select("ua.email AS author_email") ->join('LEFT', '#__users AS ua ON ua.id = a.created_by') ->join('LEFT', '#__users AS uam ON uam.id = a.modified_by'); // Filter by state $state = $this->getState('filter.published'); if (is_numeric($state)) { $query->where('a.published = ' . (int) $state); } // Filter by start and end dates. $nullDate = $db->quote($db->getNullDate()); $nowDate = $db->quote(JFactory::getDate()->toSql()); if ($this->getState('filter.publish_date')) { $query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')') ->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')'); } // Filter by search in title $search = $this->getState('list.filter'); if (!empty($search)) { $search = $db->quote('%' . $db->escape($search, true) . '%'); $query->where('(a.name LIKE ' . $search . ')'); } // Filter by language if ($this->getState('filter.language')) { $query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')'); } // Set sortname ordering if selected if ($this->getState('list.ordering') == 'sortname') { $query->order($db->escape('a.sortname1') . ' ' . $db->escape($this->getState('list.direction', 'ASC'))) ->order($db->escape('a.sortname2') . ' ' . $db->escape($this->getState('list.direction', 'ASC'))) ->order($db->escape('a.sortname3') . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); } else { $query->order($db->escape($this->getState('list.ordering', 'a.ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); } return $query; } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication(); $params = JComponentHelper::getParams('com_contact'); // List state information $format = $app->input->getWord('format'); if ($format == 'feed') { $limit = $app->getCfg('feed_limit'); } else { $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'uint'); } $this->setState('list.limit', $limit); $limitstart = $app->input->get('limitstart', 0, 'uint'); $this->setState('list.start', $limitstart); // Optional filter text $this->setState('list.filter', $app->input->getString('filter-search')); // Get list ordering default from the parameters $menuParams = new JRegistry; if ($menu = $app->getMenu()->getActive()) { $menuParams->loadString($menu->params); } $mergedParams = clone $params; $mergedParams->merge($menuParams); $orderCol = $app->input->get('filter_order', $mergedParams->get('initial_sort', 'ordering')); if (!in_array($orderCol, $this->filter_fields)) { $orderCol = 'ordering'; } $this->setState('list.ordering', $orderCol); $listOrder = $app->input->get('filter_order_Dir', 'ASC'); if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) { $listOrder = 'ASC'; } $this->setState('list.direction', $listOrder); $id = $app->input->get('id', 0, 'int'); $this->setState('category.id', $id); $user = JFactory::getUser(); if ((!$user->authorise('core.edit.state', 'com_contact')) && (!$user->authorise('core.edit', 'com_contact'))) { // limit to published for people who can't edit or edit.state. $this->setState('filter.published', 1); // Filter by start and end dates. $this->setState('filter.publish_date', true); } $this->setState('filter.language', JLanguageMultilang::isEnabled()); // Load the parameters. $this->setState('params', $params); } /** * Method to get category data for the current category * * @param integer An optional ID * * @return object * @since 1.5 */ public function getCategory() { if (!is_object($this->_item)) { $app = JFactory::getApplication(); $menu = $app->getMenu(); $active = $menu->getActive(); $params = new JRegistry; if ($active) { $params->loadString($active->params); } $options = array(); $options['countItems'] = $params->get('show_cat_items', 1) || $params->get('show_empty_categories', 0); $categories = JCategories::getInstance('Contact', $options); $this->_item = $categories->get($this->getState('category.id', 'root')); if (is_object($this->_item)) { $this->_children = $this->_item->getChildren(); $this->_parent = false; if ($this->_item->getParent()) { $this->_parent = $this->_item->getParent(); } $this->_rightsibling = $this->_item->getSibling(); $this->_leftsibling = $this->_item->getSibling(false); } else { $this->_children = false; $this->_parent = false; } } return $this->_item; } /** * Get the parent category. * * @param integer An optional category id. If not supplied, the model state 'category.id' will be used. * * @return mixed An array of categories or false if an error occurs. */ public function getParent() { if (!is_object($this->_item)) { $this->getCategory(); } return $this->_parent; } /** * Get the sibling (adjacent) categories. * * @return mixed An array of categories or false if an error occurs. */ function &getLeftSibling() { if (!is_object($this->_item)) { $this->getCategory(); } return $this->_leftsibling; } function &getRightSibling() { if (!is_object($this->_item)) { $this->getCategory(); } return $this->_rightsibling; } /** * Get the child categories. * * @param integer An optional category id. If not supplied, the model state 'category.id' will be used. * * @return mixed An array of categories or false if an error occurs. */ function &getChildren() { if (!is_object($this->_item)) { $this->getCategory(); } return $this->_children; } /** * Increment the hit counter for the category. * * @param integer $pk Optional primary key of the category to increment. * * @return boolean True if successful; false otherwise and internal error set. * * @since 3.2 */ public function hit($pk = 0) { $input = JFactory::getApplication()->input; $hitcount = $input->getInt('hitcount', 1); if ($hitcount) { $pk = (!empty($pk)) ? $pk : (int) $this->getState('category.id'); $table = JTable::getInstance('Category', 'JTable'); $table->load($pk); $table->hit($pk); } return true; } } models/rules/index.html000066600000000037150773313330011167 0ustar00 models/rules/contactemailsubject.php000066600000003362150773313330013732 0ustar00 tag for the form field object. * @param mixed $value The form field value to validate. * @param string $group The field name group control value. This acts as as an array container for the field. * For example if the field has name="foo" and the group value is set to "bar" then the * full field name would end up being "bar[foo]". * @param JRegistry $input An optional JRegistry object with the entire data set to validate against the entire form. * @param JForm $form The form object for which the field is being tested. * * @return boolean True if the value is valid, false otherwise */ public function test(SimpleXMLElement $element, $value, $group = null, JRegistry $input = null, JForm $form = null) { $params = JComponentHelper::getParams('com_contact'); $banned = $params->get('banned_subject'); if ($banned) { foreach(explode(';', $banned) as $item) { if ($item != '' && JString::stristr($value, $item) !== false) { return false; } } } return true; } } models/rules/contactemail.php000066600000003561150773313330012353 0ustar00 tag for the form field object. * @param mixed $value The form field value to validate. * @param string $group The field name group control value. This acts as as an array container for the field. * For example if the field has name="foo" and the group value is set to "bar" then the * full field name would end up being "bar[foo]". * @param JRegistry $input An optional JRegistry object with the entire data set to validate against the entire form. * @param JForm $form The form object for which the field is being tested. * * @return boolean True if the value is valid, false otherwise. */ public function test(SimpleXMLElement $element, $value, $group = null, JRegistry $input = null, JForm $form = null) { if (!parent::test($element, $value, $group, $input, $form)) { return false; } $params = JComponentHelper::getParams('com_contact'); $banned = $params->get('banned_email'); if ($banned) { foreach(explode(';', $banned) as $item) { if ($item != '' && JString::stristr($value, $item) !== false) { return false; } } } return true; } } models/rules/contactemailmessage.php000066600000003373150773313330013721 0ustar00 tag for the form field object. * @param mixed $value The form field value to validate. * @param string $group The field name group control value. This acts as as an array container for the field. * For example if the field has name="foo" and the group value is set to "bar" then the * full field name would end up being "bar[foo]". * @param JRegistry $input An optional JRegistry object with the entire data set to validate against the entire form. * @param JForm $form The form object for which the field is being tested. * * @return boolean True if the value is valid, false otherwise. */ public function test(SimpleXMLElement $element, $value, $group = null, JRegistry $input = null, JForm $form = null) { $params = JComponentHelper::getParams('com_contact'); $banned = $params->get('banned_text'); if ($banned) { foreach(explode(';', $banned) as $item) { if ($item != '' && JString::stristr($value, $item) !== false) { return false; } } } return true; } }