Exemple #1
0
 /**
  * Constructor
  *
  * @access	public
  * @return	void
  **/
 public function __construct()
 {
     $this->_ci = get_instance();
     // --------------------------------------------------------------------------
     //	Fetch our config variables
     $this->_settings = array();
     $this->_settings['appId'] = app_setting('social_signin_fb_app_id');
     $this->_settings['secret'] = app_setting('social_signin_fb_app_secret');
     $this->_settings['scope'] = app_setting('social_signin_fb_app_scope');
     if (!is_array($this->_settings['scope'])) {
         $this->_settings['scope'] = (array) $this->_settings['scope'];
     }
     if ($this->_settings['secret']) {
         $this->_settings['secret'] = $this->_ci->encrypt->decode($this->_settings['secret'], APP_PRIVATE_KEY);
     }
     //	Add the email scope
     array_unshift($this->_settings['scope'], 'email');
     $this->_settings['scope'] = array_filter($this->_settings['scope']);
     $this->_settings['scope'] = array_unique($this->_settings['scope']);
     //	Sanity check
     if (!$this->_settings['appId'] || !$this->_settings['secret']) {
         if (ENVIRONMENT === 'production') {
             show_fatal_error('Facebook has not been configured correctly', 'The Facebook App ID and secret must be specified in Admin under Site Settings.');
         } else {
             show_error('The Facebook App ID and secret must be specified in Admin under Site Settings.');
         }
     }
     // --------------------------------------------------------------------------
     //	Fire up and initialize the SDK
     $this->_facebook = new Facebook($this->_settings);
 }
Exemple #2
0
 /**
  * Constructor
  *
  * @access	public
  * @return	void
  **/
 public function __construct()
 {
     $this->_ci =& get_instance();
     // --------------------------------------------------------------------------
     //	Default vars
     $this->_access_token = '';
     $this->api_endpoint = 'https://api.linkedin.com/';
     // --------------------------------------------------------------------------
     //	Fetch our config variables
     $this->_ci->config->load('linkedin');
     $this->_settings = $this->_ci->config->item('linkedin');
     //	Fetch our config variables
     $this->_settings = array();
     $this->_settings['api_key'] = app_setting('social_signin_li_app_key');
     $this->_settings['api_secret'] = app_setting('social_signin_li_app_secret');
     if ($this->_settings['api_secret']) {
         $this->_settings['api_secret'] = $this->_ci->encrypt->decode($this->_settings['api_secret'], APP_PRIVATE_KEY);
     }
     //	Sanity check
     if (!$this->_settings['api_key'] || !$this->_settings['api_secret']) {
         if (ENVIRONMENT === 'production') {
             show_fatal_error('LinkedIn has not been configured correctly', 'The LinkedIn App ID and secret must be specified in Admin under Site Settings.');
         } else {
             show_error('The LinkedIn App ID and secret must be specified in Admin under Site Settings.');
         }
     }
 }
Exemple #3
0
 /**
  * Constructor
  *
  * @access	public
  * @param	none
  * @return	void
  **/
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     //	Is registration enabled
     if (!app_setting('user_registration_enabled', 'app')) {
         show_404();
     }
     // --------------------------------------------------------------------------
     //	Load libraries
     $this->load->library('form_validation');
     // --------------------------------------------------------------------------
     //	Specify a default title for this page
     $this->data['page']->title = lang('auth_title_register');
 }
Exemple #4
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     //	Check this module is enabled in settings
     if (!module_is_enabled('shop')) {
         //	Cancel execution, module isn't enabled
         show_404();
     }
     // --------------------------------------------------------------------------
     //	Load language file
     $this->lang->load('shop');
     // --------------------------------------------------------------------------
     //	Load the models
     $this->load->model('shop/shop_model');
     $this->load->model('shop/shop_basket_model');
     $this->load->model('shop/shop_brand_model');
     $this->load->model('shop/shop_category_model');
     $this->load->model('shop/shop_collection_model');
     $this->load->model('shop/shop_currency_model');
     $this->load->model('shop/shop_order_model');
     $this->load->model('shop/shop_product_model');
     $this->load->model('shop/shop_product_type_model');
     $this->load->model('shop/shop_range_model');
     $this->load->model('shop/shop_shipping_model');
     $this->load->model('shop/shop_sale_model');
     $this->load->model('shop/shop_tag_model');
     $this->load->model('shop/shop_voucher_model');
     $this->load->model('shop/shop_skin_model');
     // --------------------------------------------------------------------------
     //	Load up the shop's skin
     $_skin = app_setting('skin', 'shop') ? app_setting('skin', 'shop') : 'getting-started';
     $this->_skin = $this->shop_skin_model->get($_skin);
     if (!$this->_skin) {
         show_fatal_error('Failed to load shop skin "' . $_skin . '"', 'Shop skin "' . $_skin . '" failed to load at ' . APP_NAME . ', the following reason was given: ' . $this->shop_skin_model->last_error());
     }
     // --------------------------------------------------------------------------
     //	Pass to $this->data, for the views
     $this->data['skin'] = $this->_skin;
     // --------------------------------------------------------------------------
     //	Shop's name
     $this->_shop_name = app_setting('name', 'shop') ? app_setting('name', 'shop') : 'Shop';
 }
Exemple #5
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     //	Check this module is enabled in settings
     if (!module_is_enabled('blog')) {
         //	Cancel execution, module isn't enabled
         show_404();
     }
     // --------------------------------------------------------------------------
     //	Load language file
     $this->lang->load('blog/blog');
     // --------------------------------------------------------------------------
     //	Load the models
     $this->load->model('blog/blog_model');
     $this->load->model('blog/blog_post_model');
     $this->load->model('blog/blog_widget_model');
     $this->load->model('blog/blog_skin_model');
     // --------------------------------------------------------------------------
     if (app_setting('categories_enabled', 'blog')) {
         $this->load->model('blog/blog_category_model');
     }
     if (app_setting('tags_enabled', 'blog')) {
         $this->load->model('blog/blog_tag_model');
     }
     // --------------------------------------------------------------------------
     //	Load up the blog's skin
     $_skin = app_setting('skin', 'blog') ? app_setting('skin', 'blog') : 'getting-started';
     $this->_skin = $this->blog_skin_model->get($_skin);
     if (!$this->_skin) {
         show_fatal_error('Failed to load blog skin "' . $_skin . '"', 'Blog skin "' . $_skin . '" failed to load at ' . APP_NAME . ', the following reason was given: ' . $this->blog_skin_model->last_error());
     }
     // --------------------------------------------------------------------------
     //	Pass to $this->data, for the views
     $this->data['skin'] = $this->_skin;
     // --------------------------------------------------------------------------
     //	Blog name
     $this->_blog_name = app_setting('name', 'blog') ? app_setting('name', 'blog') : 'Blog';
 }
Exemple #6
0
 /**
  * Constructor
  *
  * @access	public
  * @return	void
  **/
 public function __construct()
 {
     $this->_ci =& get_instance();
     // --------------------------------------------------------------------------
     //	Fetch our config variables
     $this->_settings = array();
     $this->_settings['consumer_key'] = app_setting('social_signin_fb_app_id');
     $this->_settings['consumer_secret'] = app_setting('social_signin_fb_app_secret');
     if ($this->_settings['consumer_secret']) {
         $this->_settings['consumer_secret'] = $this->_ci->encrypt->decode($this->_settings['consumer_secret'], APP_PRIVATE_KEY);
     }
     //	Sanity check
     if (!$this->_settings['consumer_key'] || !$this->_settings['consumer_secret']) {
         if (ENVIRONMENT === 'production') {
             show_fatal_error('Twitter has not been configured correctly', 'The Twitter App ID and secret must be specified in Admin under Site Settings.');
         } else {
             show_error('The Twitter App ID and secret must be specified in Admin under Site Settings.');
         }
     }
     // --------------------------------------------------------------------------
     //	Fire up and initialize the SDK
     Codebird\Codebird::setConsumerKey($this->_settings['consumer_key'], $this->_settings['consumer_secret']);
     $this->_twitter = new Codebird\Codebird();
 }
Exemple #7
0
<div class="group-blog manager tag <?php 
echo $_is_fancybox ? 'is-fancybox' : '';
?>
">
	<?php 
if ($this->input->get('is_fancybox')) {
    echo '<h1>Tag Manager</h1>';
}
?>
	<p>
		Use tags to group specific post topics together. For example, a tag might be 'New Year <?php 
echo date('Y');
?>
', or 'Coursework'.
		<?php 
if (app_setting('categories_enabled', 'blog')) {
    echo 'For broader subjects (e.g "Music" or "Travel") consider using a ' . anchor('admin/blog/manage/categories' . $_is_fancybox, 'category') . '.';
}
?>
	</p>
	<p><strong>Create new Tag</strong></p>
	<?php 
echo form_open(uri_string() . $_is_fancybox);
echo form_input('tag', NULL, 'placeholder="Type category name and hit enter"');
echo form_close();
?>
	<p><strong>Current Tags</strong></p>
	<?php 
if ($tags) {
    echo '<ul class="current">';
    foreach ($tags as $tag) {
 public function format_url($slug)
 {
     return site_url(app_setting('url', 'shop') . 'category/' . $slug);
 }
 protected function _routes_blog()
 {
     $_routes = array();
     if (module_is_enabled('blog')) {
         $_settings = app_setting(NULL, 'blog');
         $_routes['//BEGIN BLOG'] = '';
         //	Blog front page route
         $_routes[substr($_settings['url'], 0, -1) . '(/(:any)?/?)?'] = 'blog/$2';
         $_routes['//END BLOG'] = '';
     }
     return $_routes;
 }
 protected function _generator_blog()
 {
     if (module_is_enabled('blog')) {
         $_map = array();
         // --------------------------------------------------------------------------
         $this->load->model('blog/blog_post_model');
         $_posts = $this->blog_post_model->get_all();
         $_url = app_setting('url', 'blog');
         $_counter = 0;
         // --------------------------------------------------------------------------
         //	Blog front page route
         $_map[$_counter] = new stdClass();
         $_map[$_counter]->title = htmlentities('Blog');
         //	TODO: this is silly, should blog "name" be configurable?
         $_map[$_counter]->location = site_url($_url);
         $_map[$_counter]->changefreq = 'daily';
         $_map[$_counter]->priority = 0.5;
         $_counter++;
         // --------------------------------------------------------------------------
         foreach ($_posts as $post) {
             if ($post->is_published) {
                 $_map[$_counter] = new stdClass();
                 $_map[$_counter]->title = htmlentities($post->title);
                 $_map[$_counter]->location = site_url($_url . $post->slug);
                 $_map[$_counter]->lastmod = date(DATE_ATOM, strtotime($post->modified));
                 $_map[$_counter]->changefreq = 'monthly';
                 $_map[$_counter]->priority = 0.5;
             }
             $_counter++;
         }
         // --------------------------------------------------------------------------
         return $_map;
     }
 }
Exemple #11
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     $this->data['return'] = $this->input->get('return') ? $this->input->get('return') : app_setting('url', 'shop') . 'basket';
 }
 /**
  * Validate a voucher
  *
  * @access public
  * @param int $id The voucher code to validate
  * @return	boolean
  **/
 public function validate($code, $basket = NULL)
 {
     if (!$code) {
         $this->_set_error('No voucher code supplied.');
         return FALSE;
     }
     $_voucher = $this->get_by_code($code);
     if (!$_voucher) {
         $this->_set_error('Invalid voucher code.');
         return FALSE;
     }
     // --------------------------------------------------------------------------
     //	Voucher exists, now we need to check it's still valid; this depends on the
     //	type of vocuher it is.
     //	Firstly, check common things
     //	Is active?
     if (!$_voucher->is_active) {
         $this->_set_error('Invalid voucher code.');
         return FALSE;
     }
     //	Voucher started?
     if (strtotime($_voucher->valid_from) > time()) {
         $this->_set_error('Voucher is not available yet! This voucher becomes available on the ' . date('jS F Y \\a\\t H:i', strtotime($_voucher->valid_from)) . '.');
         return FALSE;
     }
     //	Voucher expired?
     if (NULL !== $_voucher->valid_to && $_voucher->valid_to != '0000-00-00 00:00:00' && strtotime($_voucher->valid_to) < time()) {
         $this->_set_error('Voucher has expired.');
         return FALSE;
     }
     //	Is this a shipping voucher being applied to an order with no shippable items?
     if (NULL !== $basket && $_voucher->discount_application == 'SHIPPING' && !$basket->requires_shipping) {
         $this->_set_error('Your order does not contian any items which require shipping, voucher not needed!');
         return FALSE;
     }
     //	Is there a shipping threshold? If so, and the voucher is type SHIPPING
     //	and the threshold has been reached then prevent it being added as it
     //	doesn't make sense.
     if (NULL !== $basket && app_setting('free_shipping_threshold', 'shop') && $_voucher->discount_application == 'SHIPPING') {
         if ($basket->totals->sub >= app_setting('free_shipping_threshold', 'shop')) {
             $this->_set_error('Your order qualifies for free shipping, voucher not needed!');
             return FALSE;
         }
     }
     //	If the voucher applies to a particular product type, check the basket contains
     //	that product, otherwise it doesn't make sense to add it
     if (NULL !== $basket && $_voucher->discount_application == 'PRODUCT_TYPES') {
         $_matched = FALSE;
         foreach ($basket->items as $item) {
             if ($item->type->id == $_voucher->product_type_id) {
                 $_matched = TRUE;
                 break;
             }
         }
         if (!$_matched) {
             $this->_set_error('This voucher does not apply to any items in your basket.');
             return FALSE;
         }
     }
     // --------------------------------------------------------------------------
     //	Check custom voucher type conditions
     if (method_exists($this, '_validate_' . strtolower($_voucher->type))) {
         return $this->{'_validate_' . strtolower($_voucher->type)}($_voucher);
     } else {
         $this->_set_error('This voucher is corrupt and cannot be used just now.');
         return FALSE;
     }
 }
<hr />
<?php 
$_shortname = app_setting('comments_disqus_shortname', 'blog');
if ($_shortname) {
    ?>
		<div id="disqus_thread"></div>
		<script type="text/javascript">
			/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
			var disqus_shortname = '<?php 
    echo $_shortname;
    ?>
'; // required: replace example with your forum shortname

			/* * * DON'T EDIT BELOW THIS LINE * * */
			(function() {
				var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
				dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
				(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
			})();
		</script>
		<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
		<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
		<?php 
} elseif ($this->user->is_admin()) {
    ?>
		<p class="alert alert-danger">
			<strong>Disqus is not configured correctly</strong>
			<br />A shortname has not been specified for this website. Please create a shortname and define it in this site's <?php 
    anchor('admin/settings/blog', 'blog settings');
    ?>
.
Exemple #14
0
    $this->load->view($skin->path . 'views/_components/single_featured_image');
}
// --------------------------------------------------------------------------
//	Post Gallery
if ($post->gallery) {
    $this->load->view($skin->path . 'views/_components/single_gallery');
}
// --------------------------------------------------------------------------
//	Post Body
$this->load->view($skin->path . 'views/_components/single_body');
// --------------------------------------------------------------------------
//	Post Social Tools
if (app_setting('social_enabled', 'blog')) {
    $this->load->view($skin->path . 'views/_components/single_social');
}
// --------------------------------------------------------------------------
//	Categories & Tags
if (app_setting('categories_enabled', 'blog') && $post->categories || app_setting('tags_enabled', 'blog') && $post->tags) {
    echo '<hr />';
}
if (app_setting('categories_enabled', 'blog') && $post->categories) {
    $this->load->view($skin->path . 'views/_components/single_categories');
}
if (app_setting('tags_enabled', 'blog') && $post->tags) {
    $this->load->view($skin->path . 'views/_components/single_tags');
}
// --------------------------------------------------------------------------
//	Post comments
if (app_setting('comments_enabled', 'blog')) {
    $this->load->view($skin->path . 'views/_components/single_comments');
}
Exemple #15
0
 foreach ($posts as $post) {
     echo '<tr class="post" data-title="' . $post->title . '">';
     echo '<td class="image">';
     if ($post->image_id) {
         echo anchor(cdn_serve($post->image_id), img(cdn_scale($post->image_id, 75, 75)), 'class="fancybox"');
     } else {
         echo img(NAILS_ASSETS_URL . 'img/admin/modules/blog/image-icon.png');
     }
     echo '</td>';
     echo '<td class="title">';
     //	Title
     echo $post->title;
     //	URL
     echo '<small>' . anchor($post->url, $post->url, 'target="_blank"') . '</small>';
     //	Exceprt
     if (app_setting('use_excerpt', 'blog')) {
         echo '<small>' . $post->excerpt . '</small>';
     }
     echo '</td>';
     if ($post->is_published) {
         echo '<td class="status success">';
         echo '<span class="ion-checkmark-circled"></span>';
         echo '<small class="nice-time">' . user_datetime($post->published, 'Y-m-d', 'H:i:s') . '</small>';
         echo '</td>';
     } else {
         echo '<td class="status error">';
         echo '<span class="ion-close-circled"></span>';
         echo '</td>';
     }
     //	User common cells
     $this->load->view('admin/_utilities/table-cell-user', $post->author);
Exemple #16
0
					If no price can be determined then the user will receive an error indicating to them that
					they should get in touch to complete the order.
				</p>
				<?php 
if (!empty($shipping_modules)) {
    echo '<table id="shipping-modules">';
    echo '<thead class="shipping-modules">';
    echo '<tr>';
    echo '<th class="order">&nbsp;</th>';
    echo '<th class="enabled">Enabled</th>';
    echo '<th class="label">Label</th>';
    echo '<th class="configure">Configure</th>';
    echo '</tr>';
    echo '</thead>';
    echo '<tbody>';
    $_enabled_shipping_modules = set_value('enabled_shipping_modules', app_setting('enabled_shipping_modules', 'shop'));
    $_enabled_shipping_modules = array_filter((array) $_enabled_shipping_modules);
    $_modules = array();
    //	Enabled ones first, in order
    foreach ($_enabled_shipping_modules as $sm) {
        $_modules[] = $sm;
    }
    //	Followed by the others
    foreach ($shipping_modules as $sm) {
        if (array_search($sm->slug, $_modules) === FALSE) {
            $_modules[] = $sm->slug;
        }
    }
    foreach ($_modules as $slug) {
        $_module = !empty($shipping_modules[$slug]) ? $shipping_modules[$slug] : FALSE;
        if (!$_module) {
            echo '<hr />';
            echo '</li>';
        }
    }
}
if (app_setting('sidebar_popular_posts', 'blog') && !empty($widget->popular_posts)) {
    echo '<li class="widget popular-posts clearfix">';
    echo '<h3>Popular Posts</h3>';
    echo '<ul class="popular-posts">';
    foreach ($widget->popular_posts as $item) {
        echo '<li>';
        echo anchor($item->url, $item->title);
        echo '<br />';
        echo '<small class="meta">';
        echo 'Published ' . user_datetime($item->published);
        echo '</small>';
        echo '</li>';
    }
    echo '</ul>';
    echo '<hr />';
    echo '</li>';
}
// --------------------------------------------------------------------------
//	RSS
if (app_setting('rss_enabled', 'blog')) {
    echo '<li class="text-center">';
    echo anchor(app_setting('url', 'blog') . 'rss', '<span class="ion-social-rss"></span>', 'title="Subscribe via RSS"');
    echo '<li>';
}
?>
</ul>
Exemple #18
0
 /**
  * Handles a successfull connection request, This method can be overridden if more
  * than the basic data (i.e email, name, gender) is needed for account creation.
  * By this point the FB library is set up with the user's access token.
  *
  * @access	protected
  * @return	void
  **/
 protected function _connect_success($access_token)
 {
     //	Check if the user has previously connected this LinkedIn account
     //	to another registered account
     $_user = $this->user_model->get_by_liid($access_token->user_id);
     if ($this->user_model->is_logged_in() && $_user) {
         //	This LinkedIn ID is already in use, tell the user so and prevent anything else from happening.
         $this->session->set_flashdata('error', lang('auth_social_account_in_use', array('LinkedIn', APP_NAME)));
         $this->_connect_fail();
         return;
     }
     // --------------------------------------------------------------------------
     //	Test for a register token, if there verify and store it in memory
     //	We'll delete the cookie once a user has successfully registered.
     $this->_register_token = get_cookie('liRegisterToken');
     if ($this->_register_token) {
         $this->_register_token = $this->encrypt->decode($this->_register_token, APP_PRIVATE_KEY);
         if ($this->_register_token) {
             $this->_register_token = unserialize($this->_register_token);
             if ($this->_register_token) {
                 if (!isset($this->_register_token['ip']) || $this->_register_token['ip'] != $this->input->ip_address()) {
                     $this->_register_token = array();
                 }
             } else {
                 $this->_register_token = array();
             }
         } else {
             $this->_register_token = array();
         }
     } else {
         $this->_register_token = array();
     }
     // --------------------------------------------------------------------------
     //	If the user is already logged in then skip the email check and link the
     //	two accounts together.
     if ($this->user_model->is_logged_in()) {
         $this->_link_user($access_token);
     }
     // --------------------------------------------------------------------------
     //	If we recognise the user, update their access token, if not create a new account
     if (!$_user) {
         //	Not recognised via LinkedIn ID, what about via their email?
         $_user = $this->user_model->get_by_email($access_token->email);
         if (!$_user) {
             //	OK, fine, this is a new user! Registerm buyt only if registration is allowed
             if (app_setting('user_registration_enabled', 'app')) {
                 $this->_create_user($access_token);
             } else {
                 //	Registration is not enabled, fail with error
                 $this->session->set_flashdata('error', lang('auth_social_register_disabled'));
                 $this->_redirect($this->_return_to_fail);
             }
         } else {
             //	An account has been found which uses this email but this LinkedIn ID
             //	is not associated with any account. We need to alert the user that the email
             //	is already regsitered to an account and that they need to log in and link the
             //	account from their settings page, if one is defined.
             $_settings = $this->config->load('linkedin');
             if (!empty($_settings['settings_url'])) {
                 $this->session->set_flashdata('message', lang('auth_social_email_in_use', array('LinkedIn', APP_NAME)));
                 $this->_redirect('auth/login?return_to=' . urlencode($_settings['settings_url']));
             } else {
                 switch (APP_NATIVE_LOGIN_USING) {
                     case 'EMAIL':
                         $_forgot_url = site_url('auth/forgotten_password?identifier=' . urlencode($_user->email));
                         break;
                         // --------------------------------------------------------------------------
                     // --------------------------------------------------------------------------
                     case 'USERNAME':
                         $_forgot_url = site_url('auth/forgotten_password?identifier=' . urlencode($_user->username));
                         break;
                         // --------------------------------------------------------------------------
                     // --------------------------------------------------------------------------
                     case 'BOTH':
                     default:
                         $_forgot_url = site_url('auth/forgotten_password?identifier=' . urlencode($_user->email));
                         break;
                 }
                 $this->session->set_flashdata('message', lang('auth_social_email_in_use_no_settings', array('LinkedIn', APP_NAME, $_forgot_url)));
                 $this->_redirect('auth/login');
             }
             return;
         }
     } else {
         //	Existing account, log them in, update the token and bump along to the group
         //	homepage with a welcome message.
         $this->_login_user($access_token, $_user);
     }
 }
Exemple #19
0
 /**
  * Configure the shop
  *
  * @access public
  * @param none
  * @return void
  **/
 public function shop()
 {
     if (!module_is_enabled('shop')) {
         show_404();
     }
     // --------------------------------------------------------------------------
     //	Set method info
     $this->data['page']->title = lang('settings_shop_title');
     // --------------------------------------------------------------------------
     //	Load models
     $this->load->model('shop/shop_model');
     $this->load->model('shop/shop_currency_model');
     $this->load->model('shop/shop_shipping_model');
     $this->load->model('shop/shop_payment_gateway_model');
     $this->load->model('shop/shop_tax_rate_model');
     $this->load->model('shop/shop_skin_model');
     $this->load->model('system/country_model');
     // --------------------------------------------------------------------------
     //	Process POST
     if ($this->input->post()) {
         $_method = $this->input->post('update');
         if (method_exists($this, '_shop_update_' . $_method)) {
             $this->{'_shop_update_' . $_method}();
         } else {
             $this->data['error'] = '<strong>Sorry,</strong> I can\'t determine what type of update you are trying to perform.';
         }
     }
     // --------------------------------------------------------------------------
     //	Get data
     $this->data['settings'] = app_setting(NULL, 'shop', TRUE);
     $this->data['payment_gateways'] = $this->shop_payment_gateway_model->get_available();
     $this->data['shipping_modules'] = $this->shop_shipping_model->get_available();
     $this->data['skins'] = $this->shop_skin_model->get_available();
     $this->data['currencies'] = $this->shop_currency_model->get_all();
     $this->data['tax_rates'] = $this->shop_tax_rate_model->get_all();
     $this->data['tax_rates_flat'] = $this->shop_tax_rate_model->get_all_flat();
     $this->data['countries_flat'] = $this->country_model->get_all_flat();
     $this->data['continents_flat'] = $this->country_model->get_all_continents_flat();
     array_unshift($this->data['tax_rates_flat'], 'No Tax');
     // --------------------------------------------------------------------------
     //	Load assets
     $this->asset->load('nails.admin.shop.settings.min.js', TRUE);
     $this->asset->load('mustache.js/mustache.js', 'BOWER');
     $this->asset->inline('<script>_nails_settings = new NAILS_Admin_Shop_Settings();</script>');
     // --------------------------------------------------------------------------
     //	Load views
     $this->load->view('structure/header', $this->data);
     $this->load->view('admin/settings/shop', $this->data);
     $this->load->view('structure/footer', $this->data);
 }
<?php

if (app_setting('social_signin_enabled')) {
    ?>
<fieldset  id="edit-user-social" class="social">
	<legend><?php 
    echo lang('accounts_edit_social_legend');
    ?>
</legend>
	<p>
	<?php 
    if ($user_edit->fb_id || $user_edit->tw_id || $user_edit->li_id) {
        if ($user_edit->fb_id) {
            echo '<div class="icon" style="background-image: url(' . NAILS_ASSETS_URL . 'img/admin/accounts/icons/facebook-icon.png)">';
            echo 'ID: ' . $user_edit->fb_id;
            echo '<br />Token: ' . wordwrap($user_edit->fb_token, 100, '<br />', TRUE);
            echo '</div>';
        }
        // --------------------------------------------------------------------------
        if ($user_edit->tw_id) {
            echo '<div class="icon" style="background-image: url(' . NAILS_ASSETS_URL . 'img/admin/accounts/icons/twitter-icon.png)">';
            echo 'ID: ' . $user_edit->tw_id;
            echo '<br />Token: ' . wordwrap($user_edit->tw_token, 100, '<br />', TRUE);
            echo '</div>';
        }
        // --------------------------------------------------------------------------
        if ($user_edit->li_id) {
            echo '<div class="icon" style="background-image: url(' . NAILS_ASSETS_URL . 'img/admin/accounts/icons/linkedin-icon.png)">';
            echo 'ID: ' . $user_edit->li_id;
            echo '<br />Token: ' . wordwrap($user_edit->li_token, 100, '<br />', TRUE);
            echo '</div>';
 public function get_basket()
 {
     $this->load->model('shop/shop_product_model');
     // --------------------------------------------------------------------------
     $_basket = new stdClass();
     $_basket->items = array();
     $_basket->totals = new stdClass();
     $_basket->totals->sub = 0.0;
     $_basket->totals->sub_render = 0.0;
     $_basket->totals->shipping = 0.0;
     $_basket->totals->shipping_render = 0.0;
     $_basket->totals->tax_shipping = 0.0;
     $_basket->totals->tax_shipping_render = 0.0;
     $_basket->totals->tax_items = 0.0;
     $_basket->totals->tax_items_render = 0.0;
     $_basket->totals->grand = 0.0;
     $_basket->totals->grand_render = 0.0;
     $_basket->discount = new stdClass();
     $_basket->discount->shipping = 0.0;
     $_basket->discount->shipping_render = 0.0;
     $_basket->discount->items = 0.0;
     $_basket->discount->items_render = 0.0;
     $_basket->not_available = array();
     $_basket->quantity_adjusted = array();
     $_basket->requires_shipping = FALSE;
     $_basket->personal_details = $this->_personal_details;
     $_basket->shipping_method = $this->_shipping_method;
     $_basket->shipping_details = $this->_shipping_details;
     $_basket->payment_gateway = $this->_payment_gateway;
     $_basket->order_id = $this->_order_id;
     $_basket->voucher = $this->_voucher_code;
     $_not_available = array();
     //	Variable to track the amount of discount which has been used
     $_discount_total = 0;
     // --------------------------------------------------------------------------
     foreach ($this->_items as $basket_key => $item) {
         //	Fetch details about product and check availability
         $_product = $this->shop_product_model->get_by_id($item->product_id);
         //	Fetch shipping costs for this product
         if ($_product->type->requires_shipping) {
             $_product->shipping = $this->shop_shipping_model->get_price_for_product($_product->id, $_basket->shipping_method);
         } else {
             $_product->shipping = new stdClass();
             $_product->shipping->price = 0;
             $_product->shipping->price_additional = 0;
             $_product->shipping->tax_rate = 0;
         }
         if ($_product && $_product->is_active && (NULL === $_product->quantity_available || $_product->quantity_available)) {
             //	Product is still available, calculate all we need to calculate
             //	and format the basket object
             //	Do we need to adjust quantities?
             if (NULL !== $_product->quantity_available && $_product->quantity_available < $item->quantity) {
                 $_basket->quantity_adjusted = $_product->title;
             }
             // --------------------------------------------------------------------------
             $_item = new stdClass();
             $_item->id = $_product->id;
             $_item->title = $_product->title;
             $_item->type = $_product->type;
             $_item->tax = $_product->tax;
             $_item->quantity = $item->quantity;
             $_item->price = $_product->price;
             $_item->price_render = $_product->price_render;
             $_item->sale_price = $_product->sale_price;
             $_item->sale_price_render = $_product->sale_price_render;
             $_item->is_on_sale = $_product->is_on_sale;
             $_item->shipping = $_product->shipping;
             $_item->extra_data = $item->extra_data;
             // --------------------------------------------------------------------------
             //	Calculate shipping costs & taxes
             if ($_item->type->requires_shipping) {
                 if ($_item->quantity == 1) {
                     //	Just one item, flat rate
                     $_shipping = $_item->shipping->price;
                 } else {
                     //	Multiple items, first item costs `price`, then the rest are charged at `price_additional`
                     $_shipping = $_item->shipping->price + $_item->shipping->price_additional * ($_item->quantity - 1);
                 }
                 //	Shipping tax
                 $_shipping_tax = $_shipping * $_item->shipping->tax_rate;
                 // --------------------------------------------------------------------------
                 //	At least one item in this basket requires shipping, change the flag
                 $_basket->requires_shipping = TRUE;
             } else {
                 $_shipping = 0;
                 $_shipping_tax = 0;
             }
             $_item->shipping = $_shipping;
             $_item->shipping_render = shop_convert_to_user($_shipping);
             $_item->shipping_tax = $_shipping_tax;
             $_item->shipping_tax_render = shop_convert_to_user($_shipping_tax);
             // --------------------------------------------------------------------------
             //	Calculate Total
             if ($_item->is_on_sale) {
                 $_item->total = $_item->sale_price * $_item->quantity;
                 $_item->total_render = $_item->sale_price_render * $_item->quantity;
             } else {
                 $_item->total = $_item->price * $_item->quantity;
                 $_item->total_render = $_item->price_render * $_item->quantity;
             }
             // --------------------------------------------------------------------------
             //	Calculate TAX
             $_item->tax_rate = new stdClass();
             $_item->tax_rate->id = $_product->tax->id;
             $_item->tax_rate->label = round_to_precision(100 * $_product->tax->rate, 2) . '%';
             $_item->tax_rate->rate = round_to_precision($_product->tax->rate, 2);
             $_item->tax = $_item->total * $_product->tax->rate;
             $_item->tax_render = $_item->total_render * $_product->tax->rate;
             // --------------------------------------------------------------------------
             //	Is there a voucher which applies to products, or a particular product type?
             $_discount = 0;
             $_discount_render = 0;
             if ($_basket->voucher && $_basket->voucher->discount_application == 'PRODUCT_TYPES' && $_basket->voucher->product_type_id == $_item->type->id) {
                 if ($_basket->voucher->discount_type == 'PERCENTAGE') {
                     //	Simple percentage, just knock that off the product total
                     //	and be done with it.
                     $_discount = ($_item->total + $_item->tax) * ($_basket->voucher->discount_value / 100);
                     $_discount_render = ($_item->total_render + $_item->tax_render) * ($_basket->voucher->discount_value / 100);
                     $_basket->discount->items += $_discount;
                     $_basket->discount->items_render += $_discount_render;
                 } elseif ($_basket->voucher->discount_type == 'AMOUNT') {
                     //	Specific amount, if the product price is greater than the discount amount
                     //	then simply knock that off the price, if it's less then  keep track of what's
                     //	been deducted
                     if ($_discount_total < $_basket->voucher->discount_value) {
                         if ($_basket->voucher->discount_value > $_item->total + $_item->tax) {
                             //	There'll be some of the discount left over after it's been applied
                             //	to this product, work out how much
                             $_discount = $_basket->voucher->discount_value - ($_item->total + $_item->tax);
                             $_discount_render = shop_convert_to_user($_basket->voucher->discount_value) - ($_item->total_render + $_item->tax_render);
                         } else {
                             //	There'll be no discount left over, use the whole thing! ($)($)($)
                             $_discount = $_basket->voucher->discount_value;
                             $_discount_render = shop_convert_to_user($_basket->voucher->discount_value);
                         }
                         $_basket->discount->items += $_discount;
                         $_basket->discount->items_render += $_discount_render;
                         $_discount_total += $_discount;
                     }
                 }
             }
             // --------------------------------------------------------------------------
             //	Update basket totals
             $_basket->totals->sub += $_item->total;
             $_basket->totals->sub_render += $_item->total_render;
             $_basket->totals->tax_items += $_item->tax;
             $_basket->totals->tax_items_render += $_item->tax_render;
             $_basket->totals->grand += $_item->tax + $_item->shipping_tax + $_item->total + $_item->shipping - $_discount;
             $_basket->totals->grand_render += $_item->tax_render + $_item->shipping_tax_render + $_item->total_render + $_item->shipping_render - $_discount_render;
             $_basket->totals->shipping += $_item->shipping;
             $_basket->totals->shipping_render += $_item->shipping_render;
             $_basket->totals->tax_shipping += $_item->shipping_tax;
             $_basket->totals->tax_shipping_render += $_item->shipping_tax_render;
             // --------------------------------------------------------------------------
             $_basket->items[] = $_item;
         } else {
             //	No longer available
             $_not_available[] = $basket_key;
         }
     }
     // --------------------------------------------------------------------------
     //	If there's a free-shipping threshold, and it's been reached, apply a discount to the shipping
     if (app_setting('free_shipping_threshold', 'shop') && $_basket->requires_shipping) {
         if ($_basket->totals->sub >= app_setting('free_shipping_threshold', 'shop')) {
             $_basket->discount->shipping = $_basket->totals->shipping + $_basket->totals->tax_shipping;
             $_basket->totals->grand -= $_basket->discount->shipping;
             $_basket->discount->shipping_render = $_basket->totals->shipping_render + $_basket->totals->tax_shipping_render;
             $_basket->totals->grand_render -= $_basket->discount->shipping_render;
         }
     }
     // --------------------------------------------------------------------------
     //	Apply any vouchers which apply to just shipping
     if ($_basket->voucher && $_basket->voucher->discount_application == 'SHIPPING' && (!app_setting('free_shipping_threshold', 'shop') || app_setting('free_shipping_threshold', 'shop') > $_basket->totals->sub)) {
         if ($_basket->voucher->discount_type == 'PERCENTAGE') {
             //	Simple percentage, just knock that off the shipping total
             //	and be done with it.
             $_discount = ($_basket->totals->shipping + $_basket->totals->tax_shipping) * ($_basket->voucher->discount_value / 100);
             $_discount_render = ($_basket->totals->shipping_render + $_basket->totals->tax_shipping_render) * ($_basket->voucher->discount_value / 100);
         } elseif ($_basket->voucher->discount_type == 'AMOUNT') {
             //	Specific amount, if the product price is greater than the discount amount
             //	then simply knock that off the price, if it's less then  just discount the
             //	total cost of shipping
             if ($_basket->voucher->discount_value > $_basket->totals->shipping + $_basket->totals->tax_shipping) {
                 //	There'll be some of the discount left over after it's been applied
                 //	to this product, work out how much
                 $_discount = $_basket->voucher->discount_value - ($_basket->totals->shipping + $_basket->totals->tax_shipping);
                 $_discount = $_basket->voucher->discount_value - $_discount;
                 $_discount_render = shop_convert_to_user($_basket->voucher->discount_value) - ($_basket->totals->shipping_render + $_basket->totals->tax_shipping_render);
                 $_discount_render = shop_convert_to_user($_basket->voucher->discount_value) - $_discount_render;
             } else {
                 //	There'll be no discount left over, use the whole thing! ($)($)($)
                 $_discount = $_basket->voucher->discount_value;
                 $_discount_render = shop_convert_to_user($_basket->voucher->discount_value);
             }
         }
         $_basket->discount->shipping += $_discount;
         $_basket->discount->shipping_render += $_discount_render;
         // --------------------------------------------------------------------------
         //	Recalculate grand total
         $_basket->totals->grand = $_basket->totals->sub + $_basket->totals->shipping + $_basket->totals->tax_shipping + $_basket->totals->tax_items - $_basket->discount->shipping;
         $_basket->totals->grand_render = $_basket->totals->sub_render + $_basket->totals->shipping_render + $_basket->totals->tax_shipping_render + $_basket->totals->tax_items_render - $_basket->discount->shipping_render;
     } elseif ($_basket->voucher && $_basket->voucher->discount_application == 'SHIPPING' && app_setting('free_shipping_threshold', 'shop') && app_setting('free_shipping_threshold', 'shop') < $_basket->totals->sub) {
         //	Voucher no longer makes sense. Remove it.
         $this->_voucher_code = FALSE;
         $_basket->voucher = FALSE;
         $_basket->voucher_removed = 'Your order qualifies for free shipping. Voucher no longer needed!';
         $this->remove_voucher();
     }
     if ($_basket->voucher && $_basket->voucher->discount_application == 'SHIPPING' && !$_basket->requires_shipping) {
         //	Voucher no longer makes sense. Remove it.
         $this->_voucher_code = FALSE;
         $_basket->voucher = FALSE;
         $_basket->voucher_removed = 'Your order does not contian any items which require shipping, voucher not needed!';
         $this->remove_voucher();
     }
     // --------------------------------------------------------------------------
     //	Apply any vouchers which apply to just items
     if ($_basket->voucher && $_basket->voucher->discount_application == 'PRODUCTS') {
         if ($_basket->voucher->discount_type == 'PERCENTAGE') {
             //	Simple percentage, just knock that off the shipping total
             //	and be done with it.
             $_discount = ($_basket->totals->sub + $_basket->totals->tax_items) * ($_basket->voucher->discount_value / 100);
             $_discount_render = ($_basket->totals->sub_render + $_basket->totals->tax_items_render) * ($_basket->voucher->discount_value / 100);
         } elseif ($_basket->voucher->discount_type == 'AMOUNT') {
             //	Specific amount, if the product price is greater than the discount amount
             //	then simply knock that off the price, if it's less then  just discount the
             //	total cost of shipping
             if ($_basket->voucher->discount_value > $_basket->totals->sub + $_basket->totals->tax_items) {
                 //	There'll be some of the discount left over after it's been applied
                 //	to this product, work out how much
                 $_discount = $_basket->voucher->discount_value - ($_basket->totals->sub + $_basket->totals->tax_items);
                 $_discount = $_basket->voucher->discount_value - $_discount;
                 $_discount_render = shop_convert_to_user($_basket->voucher->discount_value) - ($_basket->totals->sub_render + $_basket->totals->tax_items_render);
                 $_discount_render = shop_convert_to_user($_basket->voucher->discount_value) - $_discount_render;
             } else {
                 //	There'll be no discount left over, use the whole thing! ($)($)($)
                 $_discount = $_basket->voucher->discount_value;
                 $_discount_render = shop_convert_to_user($_basket->voucher->discount_value);
             }
         }
         $_basket->discount->items += $_discount;
         $_basket->discount->items_render += $_discount_render;
         // --------------------------------------------------------------------------
         //	Recalculate grand total
         $_basket->totals->grand = $_basket->totals->sub + $_basket->totals->shipping + $_basket->totals->tax_shipping + $_basket->totals->tax_items - $_basket->discount->items;
         $_basket->totals->grand_render = $_basket->totals->sub_render + $_basket->totals->shipping_render + $_basket->totals->tax_shipping_render + $_basket->totals->tax_items_render - $_basket->discount->items_render;
     }
     // --------------------------------------------------------------------------
     //	Apply any vouchers which apply to both shipping and items
     if ($_basket->voucher && $_basket->voucher->discount_application == 'ALL') {
         $_sdiscount = 0;
         $_sdiscount_render = 0;
         $_idiscount = 0;
         $_idiscount_render = 0;
         if ($_basket->voucher->discount_type == 'PERCENTAGE') {
             //	Simple percentage, just knock that off the product and shipping totals
             //	Check free shipping threshold
             if (!app_setting('free_shipping_threshold', 'shop') || $_basket->totals->sub < app_setting('free_shipping_threshold', 'shop')) {
                 $_sdiscount = ($_basket->totals->shipping + $_basket->totals->tax_shipping) * ($_basket->voucher->discount_value / 100);
                 $_sdiscount_render = ($_basket->totals->shipping_render + $_basket->totals->tax_shipping_render) * ($_basket->voucher->discount_value / 100);
             }
             $_idiscount = ($_basket->totals->sub + $_basket->totals->tax_items) * ($_basket->voucher->discount_value / 100);
             $_idiscount_render = ($_basket->totals->sub_render + $_basket->totals->tax_items_render) * ($_basket->voucher->discount_value / 100);
         } elseif ($_basket->voucher->discount_type == 'AMOUNT') {
             //	Specific amount; if the discount is less than the product total then deduct it from
             //	that and be done, otherwise zero the products and deduct the remaining amount from the shipping
             //	If the voucher is a giftcard then the dicount value should be the remaining balance
             if ($_basket->voucher->type == 'GIFT_CARD') {
                 $_discount_value = $_basket->voucher->gift_card_balance;
                 $_discount_value_render = shop_convert_to_user($_basket->voucher->gift_card_balance);
             } else {
                 $_discount_value = $_basket->voucher->discount_value;
                 $_discount_value_render = shop_convert_to_user($_basket->voucher->discount_value);
             }
             if ($_discount_value <= $_basket->totals->sub + $_basket->totals->tax_items) {
                 //	Discount is the same as, or less than, the product total, just apply discount to the products
                 $_idiscount = $_discount_value;
                 $_idiscount_render = $_discount_value_render;
             } else {
                 //	The discount is greater than the products, apply to the shipping too
                 $_idiscount = $_basket->totals->sub + $_basket->totals->tax_items;
                 $_idiscount_render = $_basket->totals->sub_render + $_basket->totals->tax_items_render;
                 $_discount = $_discount_value - $_idiscount;
                 $_discount_render = $_discount_value_render - $_idiscount_render;
                 if ($_discount <= $_basket->totals->shipping + $_basket->totals->tax_shipping) {
                     //	Discount is less than, or the same as, the total of shipping - just remove it all
                     $_sdiscount = $_discount;
                     $_sdiscount_render = $_discount_render;
                 } else {
                     //	Discount is greater than the shipping amount, just discount the whole shipping price
                     $_sdiscount = $_basket->totals->shipping + $_basket->totals->tax_shipping;
                     $_sdiscount_render = $_basket->totals->shipping_render + $_basket->totals->tax_shipping_render;
                 }
             }
         }
         $_basket->discount->items += $_idiscount;
         $_basket->discount->items_render += $_idiscount_render;
         $_basket->discount->shipping += $_sdiscount;
         $_basket->discount->shipping_render += $_sdiscount_render;
         // --------------------------------------------------------------------------
         //	Recalculate grand total
         $_basket->totals->grand = $_basket->totals->sub + $_basket->totals->shipping + $_basket->totals->tax_shipping + $_basket->totals->tax_items - $_basket->discount->shipping - $_basket->discount->items;
         $_basket->totals->grand_render = $_basket->totals->sub_render + $_basket->totals->shipping_render + $_basket->totals->tax_shipping_render + $_basket->totals->tax_items_render - $_basket->discount->shipping_render - $_basket->discount->items_render;
     }
     // --------------------------------------------------------------------------
     //	Remove any unavailable items
     if ($_not_available) {
         foreach ($_not_available as $basket_key) {
             $_basket->not_available[] = $this->_items[$basket_key]->title;
             unset($this->_items[$basket_key]);
             // --------------------------------------------------------------------------
             $this->_update_session();
         }
     }
     // --------------------------------------------------------------------------
     $this->basket = $_basket;
     return $this->basket;
 }
Exemple #22
0
    $_field['default'] = app_setting($_field['key'], 'blog') ? TRUE : FALSE;
    echo form_field_boolean($_field);
}
// --------------------------------------------------------------------------
$_field = array();
$_field['key'] = 'sidebar_popular_posts';
$_field['label'] = 'Popular Posts';
$_field['default'] = app_setting($_field['key'], 'blog') ? TRUE : FALSE;
echo form_field_boolean($_field);
$_associations = $this->config->item('blog_post_associations');
if (is_array($_associations)) {
    foreach ($_associations as $assoc) {
        $_field = array();
        $_field['key'] = 'sidebar_association_' . $assoc->slug;
        $_field['label'] = $assoc->sidebar_title;
        $_field['default'] = app_setting($_field['key'], 'blog') ? TRUE : FALSE;
        echo form_field_boolean($_field);
    }
}
?>
				</fieldset>
				<p style="margin-top:1em;margin-bottom:0;">
					<?php 
echo form_submit('submit', lang('action_save_changes'), 'style="margin-bottom:0;"');
?>
				</p>
				<?php 
echo form_close();
?>
			</div>
Exemple #23
0
$_is_fancybox = $this->input->get('is_fancybox') ? '?is_fancybox=true' : '';
?>
<div class="group-blog manager category <?php 
echo $_is_fancybox ? 'is-fancybox' : '';
?>
">
	<?php 
if ($this->input->get('is_fancybox')) {
    echo '<h1>Category Manager</h1>';
}
?>
	<p>
		Use categories to group broad post topics together. For example, a category might be 'Music', or 'Travel'.
		<?php 
if (app_setting('tags_enabled', 'blog')) {
    echo 'For specific details (e.g New Year ' . date('Y') . ') consider using a ' . anchor('admin/blog/manage/tags' . $_is_fancybox, 'tag') . '.';
}
?>
	</p>
	<p><strong>Create new category</strong></p>
	<?php 
echo form_open(uri_string() . $_is_fancybox);
echo form_input('category', NULL, 'placeholder="Type category name and hit enter"');
echo form_close();
?>
	<p><strong>Current Categories</strong></p>
	<?php 
if ($categories) {
    echo '<ul class="current">';
    foreach ($categories as $cat) {
        }
    }
}
echo "\n";
echo 'GRAND TOTAL' . "\n";
echo shop_format_price($order->totals->grand_render, TRUE, TRUE, $_ocurrency) . "\n\n\n\n";
if ($order->voucher) {
    echo 'The following voucher was used with this order:' . "\n";
    echo $order->voucher->code . ' - ' . $order->voucher->label . "\n";
}
if ($order->requires_shipping) {
    if ($type == 'receipt') {
        echo 'The items in your order which require shipping will be shipped to the following address:' . "\n\n";
    } elseif ($type == 'notification') {
        echo 'The items in the order which require shipping must be shipped to the following address:' . "\n\n";
    }
    echo strtoupper($order->shipping_details->addressee) . "\n";
    echo $order->shipping_details->line_1 ? $order->shipping_details->line_1 . "\n" : '';
    echo $order->shipping_details->line_2 ? $order->shipping_details->line_2 . "\n" : '';
    echo $order->shipping_details->town ? $order->shipping_details->town . "\n" : '';
    echo $order->shipping_details->postcode ? $order->shipping_details->postcode . "\n" : '';
    echo $order->shipping_details->country ? $order->shipping_details->country . "\n" : '';
    echo $order->shipping_details->state ? $order->shipping_details->state . "\n" : '';
    if ($type == 'receipt') {
        $_track_token = urlencode($this->encrypt->encode($order->ref . '|' . $order->id . '|' . time(), APP_PRIVATE_KEY));
        echo "\n" . 'They will be shipped using ' . $order->shipping_method->courier . ' - ' . $order->shipping_method->method . '; you can also track the status of your order at the following URL:' . "\n";
        echo '{unwrap}' . site_url(app_setting('url', 'shop') . 'order/track?token=' . $_track_token) . '{unwrap}';
    } elseif ($type == 'notification') {
        echo "\n" . 'They must be shipped using ' . $order->shipping_method->courier . ' - ' . $order->shipping_method->method . '.' . "\n";
    }
}
Exemple #25
0
 public function get_base_currency()
 {
     $_cache = $this->_get_cache('base_currency');
     if ($_cache) {
         return $_cache;
     }
     // --------------------------------------------------------------------------
     //	Load the currency model, if not already loaded
     if (!$this->load->model_is_loaded('shop_currency_model')) {
         $this->load->model('shop/shop_currency_model');
     }
     // --------------------------------------------------------------------------
     //	Fetch base currency
     $_base = $this->shop_currency_model->get_by_code(app_setting('base_currency', 'shop'));
     //	Cache
     $this->_set_cache('base_currency', $_base);
     return $_base;
 }
$_layout = '';
$_single_title = app_setting('social_layout_single_text', 'blog') ? app_setting('social_layout_single_text', 'blog') : 'Share';
$_counters = app_setting('social_counters', 'blog') ? 'data-zeroes="yes"' : 'data-counters="no"';
$_twitter_via = app_setting('social_twitter_via', 'blog') ? app_setting('social_twitter_via', 'blog') : '';
// --------------------------------------------------------------------------
//	Layout
switch (app_setting('social_layout', 'blog')) {
    case 'HORIZONTAL':
        $_layout = '';
        break;
    case 'VERTICAL':
        $_layout = 'social-likes_vertical';
        break;
    case 'SINGLE':
        $_layout = 'social-likes_single';
        break;
}
$_enabled = array();
$_enabled[] = app_setting('social_facebook_enabled', 'blog') ? '<div class="facebook" title="Share link on Facebook">Facebook</div>' : '';
$_enabled[] = app_setting('social_twitter_enabled', 'blog') ? '<div class="twitter" data-via="' . $_twitter_via . '" title="Share link on Twitter">Twitter</div>' : '';
$_enabled[] = app_setting('social_googleplus_enabled', 'blog') ? '<div class="plusone" title="Share link on Google+">Google+</div>' : '';
$_enabled[] = app_setting('social_pinterest_enabled', 'blog') && $post->image_id ? '<div class="pinterest" data-media="' . cdn_serve($post->image_id) . '" title="Share image on Pinterest">Pinterest</div>' : '';
$_enabled = array_filter($_enabled);
if ($_enabled) {
    echo '<hr />';
    echo '<div class="social-likes ' . $_layout . '" ' . $_counters . ' data-url="' . $post->url . '" data-single-title="' . $_single_title . '" data-title="' . $post->title . '">';
    foreach ($_enabled as $enabled) {
        echo $enabled;
    }
    echo '</div>';
}
<?php

switch (app_setting('comments_engine', 'blog')) {
    case 'NATIVE':
        $this->load->view($skin->path . 'views/_components/single_comments_native');
        break;
    case 'DISQUS':
        $this->load->view($skin->path . 'views/_components/single_comments_disqus');
        break;
}
Exemple #28
0
 /**
  * Handles a successfull connection request, This method can be overridden if more
  * than the basic data (i.e email and name) is needed for account creation.
  * By this point the Twitter library is set up with the user's access token.
  *
  * @access	protected
  * @param	object $access_token The access token to use
  * @return	void
  **/
 protected function _connect_success($access_token)
 {
     //	First up, check if the user has previously connected this Twitter account
     //	to another registered account
     $_user = $this->user_model->get_by_twid($access_token->user_id);
     if ($this->user_model->is_logged_in() && $_user) {
         //	This Twitter ID is already in use, tell the user so and prevent anything else from happening.
         $this->session->set_flashdata('error', lang('auth_social_account_in_use', array('Twitter', APP_NAME)));
         $this->_connect_fail();
         return;
     }
     // --------------------------------------------------------------------------
     //	Test for a register token, if there verify and store it in memory
     //	We'll delete the cookie once a user has successfully registered.
     $this->_register_token = get_cookie('twRegisterToken');
     if ($this->_register_token) {
         $this->_register_token = $this->encrypt->decode($this->_register_token, APP_PRIVATE_KEY);
         if ($this->_register_token) {
             $this->_register_token = unserialize($this->_register_token);
             if ($this->_register_token) {
                 if (!isset($this->_register_token['ip']) || $this->_register_token['ip'] != $this->input->ip_address()) {
                     $this->_register_token = array();
                 }
             } else {
                 $this->_register_token = array();
             }
         } else {
             $this->_register_token = array();
         }
     } else {
         $this->_register_token = array();
     }
     // --------------------------------------------------------------------------
     //	If the user is already logged in then skip the email check and link the
     //	two accounts together.
     if ($this->user_model->is_logged_in()) {
         $this->_link_user($access_token);
     }
     // --------------------------------------------------------------------------
     //	If we recognise the user, update their access token, if not create a new account
     $_user = $this->user_model->get_by_twid($access_token->user_id);
     if (!$_user) {
         //	OK, fine, this is a new user! Registerm buyt only if registration is allowed
         if (app_setting('user_registration_enabled', 'app')) {
             $this->_create_user($access_token);
         } else {
             //	Registration is not enabled, fail with error
             $this->session->set_flashdata('error', lang('auth_social_register_disabled'));
             $this->_redirect($this->_return_to_fail);
         }
     } else {
         //	Existing account, log them in, update the token and bump along to the group
         //	homepage with a welcome message.
         $this->_login_user($access_token, $_user);
     }
 }
Exemple #29
0
 /**
  * Loads all the enabled sidebar widgets
  * @return void
  */
 protected function _fetch_sidebar_widgets()
 {
     //	Widgets
     if (app_setting('sidebar_enabled', 'blog')) {
         $this->data['widget'] = new stdClass();
         if (app_setting('sidebar_latest_posts', 'blog')) {
             $this->data['widget']->latest_posts = $this->blog_widget_model->latest_posts();
         }
         if (app_setting('sidebar_categories', 'blog')) {
             $this->data['widget']->categories = $this->blog_widget_model->categories();
         }
         if (app_setting('sidebar_tags', 'blog')) {
             $this->data['widget']->tags = $this->blog_widget_model->tags();
         }
         if (app_setting('sidebar_popular_posts', 'blog')) {
             $this->data['widget']->popular_posts = $this->blog_widget_model->popular_posts();
         }
     }
 }
Exemple #30
0
?>
, here's your email receipt for your records.
</p>
<p>
	Order reference <strong><?php 
echo $order->ref;
?>
</strong>, placed on the <?php 
echo date('jS F Y, \\a\\t H:i:s', strtotime($order->created));
?>
.
</p>
<?php 
$this->load->view('email/shop/utilities/order_table', array('type' => 'receipt'));
if (app_setting('invoice_company', 'shop') || app_setting('invoice_vat_no', 'shop') || app_setting('invoice_address', 'shop') || app_setting('invoice_company_no', 'shop')) {
    echo '<hr />';
    echo '<p><small>';
    if (app_setting('invoice_company', 'shop')) {
        echo '<div>Company: ' . app_setting('invoice_company', 'shop') . '</div>';
    }
    if (app_setting('invoice_vat_no', 'shop')) {
        echo '<div>VAT: ' . app_setting('invoice_vat_no', 'shop') . '</div>';
    }
    if (app_setting('invoice_address', 'shop')) {
        echo '<div>Address: ' . app_setting('invoice_address', 'shop') . '</div>';
    }
    if (app_setting('invoice_company_no', 'shop')) {
        echo '<div>Company No.: ' . app_setting('invoice_company_no', 'shop') . '</div>';
    }
    echo '</small></p>';
}