public function __construct() { parent::__construct(); \CI::auth()->check_access('Admin', true); \CI::load()->model(['Categories', 'Products', 'Pages']); \CI::lang()->load('sitemap'); }
public function index($slug, $sort = 'id', $dir = "ASC", $page = 0) { \CI::lang()->load('categories'); //define the URL for pagination $pagination_base_url = site_url('category/' . $slug . '/' . $sort . '/' . $dir); //how many products do we want to display per page? //this is configurable from the admin settings page. $per_page = config_item('products_per_page'); //grab the categories $categories = \CI::Categories()->get($slug, $sort, $dir, $page, $per_page); //no category? show 404 if (!$categories) { throw_404(); return; } $categories['sort'] = $sort; $categories['dir'] = $dir; $categories['slug'] = $slug; $categories['page'] = $page; //load up the pagination library \CI::load()->library('pagination'); $config['base_url'] = $pagination_base_url; $config['uri_segment'] = 5; $config['per_page'] = $per_page; $config['num_links'] = 3; $config['total_rows'] = $categories['total_products']; \CI::pagination()->initialize($config); //load the view $this->view('categories/category', $categories); }
public function login() { $redirect = \CI::auth()->isLoggedIn(false, false); if ($redirect) { redirect('admin/dashboard'); } \CI::load()->helper('form'); $data['redirect'] = \CI::session()->flashdata('redirect'); $submitted = \CI::input()->post('submitted'); if ($submitted) { $username = \CI::input()->post('username'); $password = \CI::input()->post('password'); $remember = \CI::input()->post('remember'); $redirect = \CI::input()->post('redirect'); $login = \CI::auth()->login_admin($username, $password, $remember); if ($login) { if ($redirect == '') { $redirect = 'admin/dashboard'; } redirect($redirect); } else { //this adds the redirect back to flash data if they provide an incorrect credentials \CI::session()->set_flashdata('redirect', $redirect); \CI::session()->set_flashdata('error', lang('error_authentication_failed')); redirect('admin/login'); } } $this->views->show('admin/header', $data); $this->views->show('admin/login', $data); $this->views->show('admin/footer', $data); }
function __construct() { parent::__construct(); \CI::auth()->check_access('Admin', true); \CI::load()->model(['Orders', 'Search']); \CI::load()->helper(array('formatting')); \CI::lang()->load('reports'); }
public function __construct() { parent::__construct(); \CI::auth()->check_access('Admin', true); \CI::load()->model(['Products', 'Categories']); \CI::load()->helper('form'); \CI::lang()->load('products'); }
public function __construct() { parent::__construct(); \CI::load()->model('GiftCards'); \CI::load()->helper('form'); \CI::load()->library('form_validation'); \CI::lang()->load('gift_cards'); }
function lap_dat() { \CI::load()->model(['Materials']); $tmp = \CI::Materials()->getMaterials(); echo '<pre>'; print_r($tmp); exit; }
public function set($kVA, $phase, $gen_number) { \CI::load()->model(['Materials']); $this->kVA = $kVA; $this->phase = $phase; $this->gen_number = $gen_number; $this->data = \CI::Materials()->getMaterials($kVA, $gen_number); //echo '<pre>';print_r($this->data);exit; }
public function index($code = false, $page = 0) { $pagination_base_url = site_url('search/' . $code); //how many products do we want to display per page? //this is configurable from the admin settings page. $per_page = config_item('products_per_page'); \CI::load()->model('Search'); //check to see if we have a search term if (!$code) { //if the term is in post, save it to the db and give me a reference $term = \CI::input()->post('term', true); if (empty($term)) { //if there is still no search term throw an error $data['error'] = lang('search_error'); $this->view('search_error', $data); return; } else { $code = \CI::Search()->recordTerm($term); // no code? redirect so we can have the code in place for the sorting. // I know this isn't the best way... redirect('search/' . $code . '/' . $page); } } else { //if we have the md5 string, get the term $term = \CI::Search()->getTerm($code); } //fix for the category view page. $data['base_url'] = []; $sortArray = array('name/asc' => array('by' => 'name', 'sort' => 'ASC'), 'name/desc' => array('by' => 'name', 'sort' => 'DESC'), 'price/asc' => array('by' => 'price', 'sort' => 'ASC'), 'price/desc' => array('by' => 'price', 'sort' => 'DESC')); $sortBy = array('by' => false, 'sort' => false); if (isset($_GET['by'])) { if (isset($sortArray[$_GET['by']])) { $sortBy = $sortArray[$_GET['by']]; } } if (empty($term)) { //if there is still no search term throw an error $this->view('search_error', $data); return; } else { $result = \CI::Products()->search_products($term, $per_page, $page, $sortBy['by'], $sortBy['sort']); $config['total_rows'] = $result['count']; \CI::load()->library('pagination'); $config['base_url'] = $pagination_base_url; $config['uri_segment'] = 3; $config['per_page'] = $per_page; $config['num_links'] = 3; $config['total_rows'] = $result['count']; \CI::pagination()->initialize($config); $data['products'] = $result['products']; $data['category'] = (object) ['name' => str_replace('{term}', $term, lang('search_title'))]; $this->view('categories/category', $data); } }
public function api($slug) { \CI::load()->language('page'); $page = $this->Page_model->slug($slug); if (!$page) { $json = json_encode(['error' => lang('error_page_not_found')]); } else { $json = json_encode($page); } $this->view('json', ['json' => json_encode($json)]); }
public function __construct() { parent::__construct(); if (\CI::auth()->check_access('Orders')) { redirect(config_item('admin_folder') . '/orders'); } \CI::load()->model('Orders'); \CI::load()->model('Customers'); \CI::load()->helper('date'); \CI::lang()->load('dashboard'); }
public function index() { \CI::auth()->check_access('Admin', true); \CI::lang()->load('settings'); \CI::load()->helper('inflector'); global $shippingModules; $data['shipping_modules'] = $shippingModules; $data['enabled_modules'] = \CI::Settings()->get_settings('shipping_modules'); $data['page_title'] = lang('common_shipping_modules'); $this->view('shipping_index', $data); }
public function index() { \CI::auth()->check_access('Admin', true); \CI::lang()->load('settings'); \CI::load()->helper('inflector'); global $paymentModules; //Payment Information $payment_order = \CI::Settings()->get_settings('payment_order'); $data['payment_modules'] = $paymentModules; $data['enabled_modules'] = \CI::Settings()->get_settings('payment_modules'); $data['page_title'] = lang('common_payment_modules'); $this->view('payment_index', $data); }
public function __construct() { parent::__construct(); //add the theme to the packages path \CI::load()->add_package_path(FCPATH . 'themes/' . config_item('theme') . '/'); \CI::load()->model(array('Pages', 'Customers', 'Login', 'Categories', 'Coupons', 'Locations', 'Products', 'ProductOptions', 'DigitalProducts')); //load in some base information \CI::load()->helper('theme'); \CI::lang()->load('common'); $this->pages = \CI::Pages()->get_pages_tiered(); //see if the customer is logged in. //if the customer is not logged in, then we'll have a temporary guest customer created. $this->isLoggedIn = \CI::Login()->isLoggedIn(); }
public function form() { //this same function processes the form \CI::load()->helper('form'); \CI::load()->library('form_validation'); \CI::form_validation()->set_rules('enabled', 'lang:enabled', 'trim|numeric'); \CI::form_validation()->set_rules('rate', 'lang:rate', 'trim|floatval'); if (\CI::form_validation()->run() == FALSE) { $settings = \CI::Settings()->get_settings('FlatRate'); $this->view('flat_rate_form', $settings); } else { \CI::Settings()->save_settings('FlatRate', \CI::input()->post()); redirect('admin/shipping'); } }
public function form() { //this same function processes the form \CI::load()->helper('form'); \CI::load()->library('form_validation'); \CI::form_validation()->set_rules('enabled', 'lang:enabled', 'trim|numeric'); if (\CI::form_validation()->run() == FALSE) { $settings = \CI::Settings()->get_settings('cod'); $enabled = $settings['enabled']; $this->view('cod_form', ['enabled' => $enabled]); } else { \CI::Settings()->save_settings('cod', array('enabled' => $_POST['enabled'])); redirect('admin/payments'); } }
public function delete($id) { CI::load()->model('Products'); $info = $this->getFileInfo($id); if (!$info) { return false; } // remove file if ($this->verifyContent($info->filename)) { unlink('uploads/digital_products/' . $info->filename); } // Remove db associations CI::db()->where('id', $id)->delete('digital_products'); $this->disassociate($id); //remove the item from orders that have a connection to this file CI::db()->where('file_id', $id)->delete('order_item_files'); }
public function form($id = 0) { \CI::load()->helper('form_helper'); \CI::load()->library('form_validation'); \CI::form_validation()->set_error_delimiters('<div class="error">', '</div>'); $data = ['id' => '', 'filename' => '', 'max_downloads' => '', 'title' => '', 'size' => '']; if ($id) { $data = array_merge($data, (array) \CI::DigitalProducts()->getFileInfo($id)); } $data['page_title'] = lang('digital_products_form'); \CI::form_validation()->set_rules('max_downloads', 'lang:max_downloads', 'numeric'); \CI::form_validation()->set_rules('title', 'lang:title', 'trim|required'); if (\CI::form_validation()->run() == FALSE) { $this->view('digital_product_form', $data); } else { if ($id == 0) { $data['file_name'] = false; $data['error'] = false; $config['allowed_types'] = '*'; $config['upload_path'] = 'uploads/digital_products'; //config_item('digital_products_path'); $config['remove_spaces'] = true; \CI::load()->library('upload', $config); if (\CI::upload()->do_upload()) { $upload_data = \CI::upload()->data(); } else { $data['error'] = \CI::upload()->display_errors(); $this->view('digital_product_form', $data); return; } $save['filename'] = $upload_data['file_name']; $save['size'] = $upload_data['file_size']; } else { $save['id'] = $id; } $save['max_downloads'] = \CI::input()->post('max_downloads'); $save['title'] = \CI::input()->post('title'); \CI::DigitalProducts()->save($save); redirect('admin/digital_products'); } }
public function sendNotification($gc_data) { CI::load()->helper('formatting_helper'); $row = CI::db()->where('id', '1')->get('canned_messages')->row_array(); // set replacement values for subject & body $row['subject'] = str_replace('{from}', $gc_data['from'], $row['subject']); $row['subject'] = str_replace('{site_name}', config_item('company_name'), $row['subject']); $row['content'] = str_replace('{code}', $gc_data['code'], $row['content']); $row['content'] = str_replace('{amount}', format_currency($gc_data['beginning_amount']), $row['content']); $row['content'] = str_replace('{from}', $gc_data['from'], $row['content']); $row['content'] = str_replace('{personal_message}', nl2br($gc_data['personal_message']), $row['content']); $row['content'] = str_replace('{url}', config_item('base_url'), $row['content']); $row['content'] = str_replace('{site_name}', config_item('company_name'), $row['content']); $config['mailtype'] = 'html'; CI::load()->library('email'); CI::email()->initialize($config); CI::email()->from(config_item('email')); CI::email()->to($gc_data['to_email']); CI::email()->subject($row['subject']); CI::email()->message($row['content']); CI::email()->send(); }
public function upload_image() { $config['upload_path'] = 'uploads/wysiwyg/images'; $config['allowed_types'] = 'gif|jpg|png'; \CI::load()->library('upload', $config); if (!\CI::upload()->do_upload('file')) { $error = array('error' => \CI::upload()->display_errors('', '')); echo stripslashes(json_encode($error)); } else { $data = \CI::upload()->data(); //upload successful generate a thumbnail $config['image_library'] = 'gd2'; $config['source_image'] = 'uploads/wysiwyg/images/' . $data['file_name']; $config['new_image'] = 'uploads/wysiwyg/thumbnails/' . $data['file_name']; $config['create_thumb'] = FALSE; $config['maintain_ratio'] = TRUE; $config['width'] = 75; $config['height'] = 50; \CI::load()->library('image_lib', $config); \CI::image_lib()->resize(); $data = array('filelink' => base_url('uploads/wysiwyg/images/' . $data['file_name']), 'filename' => $data['file_name']); echo stripslashes(json_encode($data)); } }
public function login($redirect = '') { //find out if they're already logged in, if they are redirect them to the my account page if (\CI::Login()->isLoggedIn(false, false)) { redirect($redirect); } \CI::load()->library('form_validation'); \CI::form_validation()->set_rules('email', 'lang:address_email', ['trim', 'required', 'valid_email']); \CI::form_validation()->set_rules('password', 'Password', ['required', ['check_login_callable', function ($str) { $email = \CI::input()->post('email'); $password = \CI::input()->post('password'); $remember = \CI::input()->post('remember'); $login = \CI::Login()->loginCustomer($email, sha1($password), $remember); if (!$login) { \CI::form_validation()->set_message('check_login_callable', lang('login_failed')); return false; } }]]); if (\CI::form_validation()->run() == FALSE) { $this->view('login', ['redirect' => $redirect]); } else { redirect($redirect); } }
public function canned_message_form($id = false) { $data['page_title'] = lang('canned_message_form'); $data['id'] = $id; $data['name'] = ''; $data['subject'] = ''; $data['content'] = ''; $data['deletable'] = 1; if ($id) { $message = \CI::Messages()->get_message($id); $data = array_merge($data, $message); } \CI::load()->helper('form'); \CI::load()->library('form_validation'); \CI::form_validation()->set_rules('name', 'lang:message_name', 'trim|required|max_length[50]'); \CI::form_validation()->set_rules('subject', 'lang:subject', 'trim|required|max_length[100]'); \CI::form_validation()->set_rules('content', 'lang:message_content', 'trim|required'); if (\CI::form_validation()->run() == FALSE) { $data['errors'] = validation_errors(); $this->view('canned_message_form', $data); } else { $save['id'] = $id; $save['name'] = \CI::input()->post('name'); $save['subject'] = \CI::input()->post('subject'); $save['content'] = \CI::input()->post('content'); //all created messages are typed to order so admins can send them from the view order page. if ($data['deletable']) { $save['type'] = 'order'; } \CI::Messages()->save_message($save); \CI::session()->set_flashdata('message', lang('message_saved_message')); redirect('admin/settings/canned_messages'); } }
public function index() { $redirect = \CI::Login()->isLoggedIn(false, false); //if they are logged in, we send them back to the my_account by default if ($redirect) { redirect('my-account'); } \CI::load()->library('form_validation'); //default values are empty if the customer is new $data = ['company' => '', 'firstname' => '', 'lastname' => '', 'email' => '', 'phone' => '', 'address1' => '', 'address2' => '', 'city' => '', 'state' => '', 'zip' => '', 'redirect' => \CI::session()->flashdata('redirect')]; \CI::form_validation()->set_rules('company', 'lang:address_company', 'trim|max_length[128]'); \CI::form_validation()->set_rules('firstname', 'lang:address_firstname', 'trim|required|max_length[32]'); \CI::form_validation()->set_rules('lastname', 'lang:address_lastname', 'trim|required|max_length[32]'); \CI::form_validation()->set_rules('email', 'lang:address_email', ['trim', 'required', 'valid_email', 'max_length[128]', ['check_email_callable', function ($str) { return $this->check_email($str); }]]); \CI::form_validation()->set_rules('phone', 'lang:address_phone', 'trim|required|max_length[32]'); \CI::form_validation()->set_rules('email_subscribe', 'lang:account_newsletter_subscribe', 'trim|numeric|max_length[1]'); \CI::form_validation()->set_rules('password', 'Password', 'required|min_length[6]'); \CI::form_validation()->set_rules('confirm', 'Confirm Password', 'required|matches[password]'); if (\CI::form_validation()->run() == FALSE) { //if they have submitted the form already and it has returned with errors, reset the redirect if (\CI::input()->post('submitted')) { $data['redirect'] = \CI::input()->post('redirect'); } // load other page content //\CI::load()->model('banner_model'); \CI::load()->helper('directory'); $this->view('register', $data); } else { $save['id'] = false; $save['firstname'] = \CI::input()->post('firstname'); $save['lastname'] = \CI::input()->post('lastname'); $save['email'] = \CI::input()->post('email'); $save['phone'] = \CI::input()->post('phone'); $save['company'] = \CI::input()->post('company'); $save['active'] = config_item('new_customer_status'); $save['email_subscribe'] = intval((bool) \CI::input()->post('email_subscribe')); $save['password'] = \CI::input()->post('password'); $redirect = \CI::input()->post('redirect'); //if we don't have a value for redirect if ($redirect == '') { $redirect = 'my-account'; } // save the customer info and get their new id $id = \CI::Customers()->save($save); /* send an email */ // get the email template $row = \CI::db()->where('id', '6')->get('canned_messages')->row_array(); // set replacement values for subject & body // {customer_name} $row['subject'] = str_replace('{customer_name}', \CI::input()->post('firstname') . ' ' . \CI::input()->post('lastname'), $row['subject']); $row['content'] = str_replace('{customer_name}', \CI::input()->post('firstname') . ' ' . \CI::input()->post('lastname'), $row['content']); // {url} $row['subject'] = str_replace('{url}', config_item('base_url'), $row['subject']); $row['content'] = str_replace('{url}', config_item('base_url'), $row['content']); // {site_name} $row['subject'] = str_replace('{site_name}', config_item('company_name'), $row['subject']); $row['content'] = str_replace('{site_name}', config_item('company_name'), $row['content']); \CI::load()->library('email'); $config['mailtype'] = 'html'; \CI::email()->initialize($config); \CI::email()->from(config_item('email'), config_item('company_name')); \CI::email()->to($save['email']); \CI::email()->bcc(config_item('email')); \CI::email()->subject($row['subject']); \CI::email()->message(html_entity_decode($row['content'])); \CI::email()->send(); \CI::session()->set_flashdata('message', sprintf(lang('registration_thanks'), \CI::input()->post('firstname'))); //lets automatically log them in \CI::Login()->loginCustomer($save['email'], \CI::input()->post('confirm')); //we're just going to make this secure regardless, because we don't know if they are //wanting to redirect to an insecure location, if it needs to be secured then we can use the secure redirect in the controller //to redirect them, if there is no redirect, the it should redirect to the homepage. redirect($redirect); } }
public function zone_area_form($zone_id, $area_id = false) { \CI::load()->helper('form'); \CI::load()->library('form_validation'); \CI::form_validation()->set_error_delimiters('<div class="error">', '</div>'); $zone = \CI::Locations()->get_zone($zone_id); $data['zone'] = $zone; //default values are empty if the product is new $data['id'] = ''; $data['code'] = ''; $data['zone_id'] = $zone_id; $data['tax'] = 0; if ($area_id) { $area = (array) \CI::Locations()->get_zone_area($area_id); //if the country does not exist, redirect them to the country list with an error if (!$area) { \CI::session()->set_flashdata('error', lang('error_zone_area_not_found')); redirect('admin/locations/zone_areas/' . $zone_id); } $data = array_merge($data, $area); } \CI::form_validation()->set_rules('code', 'lang:code', 'trim|required'); \CI::form_validation()->set_rules('tax', 'lang:tax', 'trim|numeric'); if (\CI::form_validation()->run() == FALSE) { $this->view('country_zone_area_form', $data); } else { $save['id'] = $area_id; $save['zone_id'] = $zone_id; $save['code'] = \CI::input()->post('code'); $save['tax'] = \CI::input()->post('tax'); \CI::Locations()->save_zone_area($save); \CI::session()->set_flashdata('message', lang('message_saved_zone_area')); //go back to the product list redirect('admin/locations/zone_areas/' . $save['zone_id']); } }
public function sendNotification($order_id = '') { // send the message $config['mailtype'] = 'html'; \CI::load()->library('email'); \CI::email()->initialize($config); \CI::email()->from(config_item('email'), config_item('company_name')); \CI::email()->to(\CI::input()->post('recipient')); \CI::email()->subject(\CI::input()->post('subject')); \CI::email()->message(html_entity_decode(\CI::input()->post('content'))); \CI::email()->send(); \CI::session()->set_flashdata('message', lang('sent_notification_message')); redirect('admin/orders/order/' . $order_id); }
public function form($id = false) { \CI::load()->helper(array('form', 'date')); \CI::load()->library('form_validation'); \CI::form_validation()->set_error_delimiters('<div class="error">', '</div>'); $this->coupon_id = $id; $data['page_title'] = lang('coupon_form'); //default values are empty if the product is new $data['id'] = ''; $data['code'] = ''; $data['start_date'] = ''; $data['whole_order_coupon'] = 0; $data['max_product_instances'] = ''; $data['end_date'] = ''; $data['max_uses'] = ''; $data['reduction_type'] = ''; $data['reduction_amount'] = ''; $data['products'] = []; if ($id) { $coupon = \CI::Coupons()->getCoupon($id); //if the product does not exist, redirect them to the product list with an error if (!$coupon) { \CI::session()->set_flashdata('message', lang('error_not_found')); redirect('admin/product'); } //set values to db values $data['id'] = $coupon->id; $data['code'] = $coupon->code; $data['start_date'] = $coupon->start_date; $data['end_date'] = $coupon->end_date; $data['whole_order_coupon'] = $coupon->whole_order_coupon; $data['max_product_instances'] = $coupon->max_product_instances; $data['num_uses'] = $coupon->num_uses; $data['max_uses'] = $coupon->max_uses; $data['reduction_type'] = $coupon->reduction_type; $data['reduction_amount'] = $coupon->reduction_amount; $data['products'] = \CI::Coupons()->getProducts($id); } \CI::form_validation()->set_rules('code', 'lang:code', ['trim', 'required', ['code_callable', function ($str) { $code = \CI::Coupons()->checkCode($str, $this->coupon_id); if ($code) { \CI::form_validation()->set_message('code_callable', lang('error_already_used')); return FALSE; } else { return TRUE; } }]]); \CI::form_validation()->set_rules('max_uses', 'lang:max_uses', 'trim|numeric'); \CI::form_validation()->set_rules('max_product_instances', 'lang:limit_per_order', 'trim|numeric'); \CI::form_validation()->set_rules('whole_order_coupon', 'lang:whole_order_discount'); \CI::form_validation()->set_rules('reduction_type', 'lang:reduction_type', 'trim'); \CI::form_validation()->set_rules('reduction_amount', 'lang:reduction_amount', 'trim|numeric'); \CI::form_validation()->set_rules('start_date', 'lang:start_date'); \CI::form_validation()->set_rules('end_date', 'lang:end_date'); if (\CI::form_validation()->run() == FALSE) { if (\CI::input()->post()) { $data['products'] = json_decode(json_encode(\CI::input()->post('product'))); } $this->view('coupon_form', $data); } else { $save['id'] = $id; $save['code'] = \CI::input()->post('code'); $save['start_date'] = \CI::input()->post('start_date'); $save['end_date'] = \CI::input()->post('end_date'); $save['max_uses'] = \CI::input()->post('max_uses'); $save['whole_order_coupon'] = \CI::input()->post('whole_order_coupon'); $save['max_product_instances'] = \CI::input()->post('max_product_instances'); $save['reduction_type'] = \CI::input()->post('reduction_type'); $save['reduction_amount'] = \CI::input()->post('reduction_amount'); if ($save['start_date'] == '') { $save['start_date'] = null; } if ($save['end_date'] == '') { $save['end_date'] = null; } $products = \CI::input()->post('product'); // save coupon $id = \CI::Coupons()->save($save); \CI::Coupons()->removeProduct($id); if (!$save['whole_order_coupon'] && $products) { \CI::Coupons()->addProducts($id, $products); } // We're done \CI::session()->set_flashdata('message', lang('message_saved_coupon')); //go back to the product list redirect('admin/coupons'); } }
public function __construct() { parent::__construct(); CI::load()->helper('formatting_helper'); }
public function product_image_upload() { $data['file_name'] = false; $data['error'] = false; $config['allowed_types'] = 'gif|jpg|png'; //$config['max_size'] = config_item('size_limit'); $config['upload_path'] = 'uploads/images/full'; $config['encrypt_name'] = true; $config['remove_spaces'] = true; \CI::load()->library('upload', $config); if (\CI::upload()->do_upload()) { $upload_data = \CI::upload()->data(); \CI::load()->library('image_lib'); $config['image_library'] = 'gd2'; $config['source_image'] = 'uploads/images/full/' . $upload_data['file_name']; $config['new_image'] = 'uploads/images/medium/' . $upload_data['file_name']; $config['maintain_ratio'] = TRUE; $config['width'] = 600; $config['height'] = 500; \CI::image_lib()->initialize($config); \CI::image_lib()->resize(); \CI::image_lib()->clear(); //small image $config['image_library'] = 'gd2'; $config['source_image'] = 'uploads/images/medium/' . $upload_data['file_name']; $config['new_image'] = 'uploads/images/small/' . $upload_data['file_name']; $config['maintain_ratio'] = TRUE; $config['width'] = 235; $config['height'] = 235; \CI::image_lib()->initialize($config); \CI::image_lib()->resize(); \CI::image_lib()->clear(); //cropped thumbnail $config['image_library'] = 'gd2'; $config['source_image'] = 'uploads/images/small/' . $upload_data['file_name']; $config['new_image'] = 'uploads/images/thumbnails/' . $upload_data['file_name']; $config['maintain_ratio'] = TRUE; $config['width'] = 150; $config['height'] = 150; \CI::image_lib()->initialize($config); \CI::image_lib()->resize(); \CI::image_lib()->clear(); $data['file_name'] = $upload_data['file_name']; } if (\CI::upload()->display_errors() != '') { $data['error'] = \CI::upload()->display_errors(); } $this->partial('iframe/product_image_uploader', $data); }
public function __construct() { \CI::load()->helper('form'); \CI::load()->library('breadcrumbs'); $this->views = View::getInstance(); }
public function download($link) { $filedata = \CI::DigitalProducts()->get_file_info_by_link($link); // missing file (bad link) if (!$filedata) { show_404(); } // validate download counter if ($filedata->max_downloads > 0) { if (intval($filedata->downloads) >= intval($filedata->max_downloads)) { show_404(); } } // increment downloads counter \CI::DigitalProducts()->touch_download($link); // Deliver file \CI::load()->helper('download'); force_download('uploads/digital_uploads/', $filedata->filename); }