public function __construct() { $registry = \Core\Registry::getInstance(); $this->config = $registry->get('config'); $this->db = $registry->get('db'); $this->request = $registry->get('request'); $this->session = $registry->get('session'); if (isset($this->session->data['customer_id'])) { $customer_query = $this->db->query("SELECT * FROM #__customer WHERE customer_id = '" . (int) $this->session->data['customer_id'] . "' AND status = '1'"); if ($customer_query->num_rows) { $this->customer_id = $customer_query->row['customer_id']; $this->firstname = $customer_query->row['firstname']; $this->lastname = $customer_query->row['lastname']; $this->email = $customer_query->row['email']; $this->telephone = $customer_query->row['telephone']; $this->fax = $customer_query->row['fax']; $this->newsletter = $customer_query->row['newsletter']; $this->customer_group_id = $customer_query->row['customer_group_id']; $this->address_id = $customer_query->row['address_id']; $query = $this->db->query("SELECT * FROM #__customer_ip WHERE customer_id = '" . (int) $this->session->data['customer_id'] . "' AND ip = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "'"); if (!$query->num_rows) { $this->db->query("INSERT INTO #__customer_ip SET customer_id = '" . (int) $this->session->data['customer_id'] . "', ip = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "', date_added = NOW()"); } } else { $this->logout(); } } }
protected function _setcategories($data) { $return = array(); $categories = json_decode($data['content']); foreach ($categories as $category) { $category = $this->loadParent($category)->toArray(); $category['href'] = \Core\Registry::getInstance()->get('url')->link('blog/category', 'ams_page_id=' . $category['id']); $return[] = $category; } return $return; }
function registry($key = false) { if ($key) { return \Core\Registry::getInstance()->get($key); } return \Core\Registry::getInstance(); }
public function output() { if ($this->output) { $output = $this->output; //Lets Replace all Instances of <!--{{MODULE POST}}--> preg_match_all('/<!--{{(.*)}}-->/Uis', $output, $matches, PREG_SET_ORDER); if ($matches) { foreach ($matches as $match) { $res = $this->getChild('common/custom_position', $match[1]); if ($res) { $output = str_replace($match[0], $res, $output); } } } $output = \Core\Shortcode::doShortcode($output); $doc = \Core\Registry::getInstance()->get('document'); $scripts = $doc->getScripts(); if ($scripts) { $html = ''; foreach ($scripts as $script) { $html .= '<script type="text/javascript" src="' . $script . '"></script>'; } $output = str_replace('<!-- Custom JS -->', $html, $output); } $styles = $doc->getStyles(); if ($styles) { $html = ''; foreach ($styles as $style) { $html .= '<link rel="' . $style['rel'] . '" type="text/css" href="' . $style['href'] . '" media="' . $style['media'] . '" />'; } $output = str_replace('<!-- Custom CSS -->', $html, $output); } $metas = $doc->getMeta(); if ($metas) { $html = ''; foreach ($metas as $meta) { $html .= '<meta ' . $meta['meta'] . '="' . $meta['key'] . '" content="' . $meta['value'] . '" />' . "\n"; } $output = str_replace('<!-- Custom META -->', $html, $output); } \Core\Registry::getInstance()->get('event')->trigger('before.render', $output); if ($this->level) { $output = $this->compress($output, $this->level); $this->addHeader('Content-Length: ' . strlen($output)); } if (!headers_sent()) { foreach ($this->headers as $header) { header($header, true); } } echo $output; } }