mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-04 22:06:05 -04:00
Database logic additions
- Migration script to create default values - Corrected naming of variables in general_config.php - Replaced hardcoded values with db variables
This commit is contained in:
@@ -669,13 +669,11 @@ class Items extends Secure_Controller
|
||||
{
|
||||
//Load upload library
|
||||
$config = array('upload_path' => './uploads/item_pics/',
|
||||
'allowed_types' => 'gif|jpg|png',
|
||||
'max_size' => '100',
|
||||
'max_width' => '640',
|
||||
'max_height' => '480'
|
||||
);
|
||||
|
||||
$this->load->library('upload', $config);
|
||||
'allowed_types' => $this->config->item('image_allowed_types'),
|
||||
'max_size' => $this->config->item('image_max_size'),
|
||||
'max_width' => $this->config->item('image_max_width'),
|
||||
'max_height' => $this->config->item('image_max_height'));
|
||||
$this->load->library('upload', $config);
|
||||
$this->upload->do_upload('item_image');
|
||||
|
||||
return strlen($this->upload->display_errors()) == 0 || !strcmp($this->upload->display_errors(), '<p>'.$this->lang->line('upload_no_file_selected').'</p>');
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Migration_image_upload_defaults extends CI_Migration
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function up()
|
||||
{
|
||||
$image_values = array(
|
||||
array('key' => 'allowed_types', 'value' => 'gif|jpg|png'),
|
||||
array('key' => 'max_height', 'value' => '480'),
|
||||
array('key' => 'max_size', 'value' => '100'),
|
||||
array('key' => 'max_width', 'value' => '640'));
|
||||
|
||||
$this->db->insert_batch('app_config', $image_values);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->db->where_in('key', array('allowed_types','max_height','max_size','max_width'));
|
||||
$this->db->delete('app_config');
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -143,7 +143,7 @@
|
||||
'type' => 'number',
|
||||
'min' => 128,
|
||||
'max' => 3840,
|
||||
'value' => $this->config->item('max_image_width'),
|
||||
'value' => $this->config->item('image_max_width'),
|
||||
'data-toggle' => 'tooltip',
|
||||
'data-placement' => 'top',
|
||||
'title' => $this->lang->line('config_image_max_width_tooltip')));
|
||||
@@ -160,7 +160,7 @@
|
||||
'type' => 'number',
|
||||
'min' => 128,
|
||||
'max' => 3840,
|
||||
'value' => $this->config->item('max_image_height'),
|
||||
'value' => $this->config->item('image_max_height'),
|
||||
'data-toggle' => 'tooltip',
|
||||
'data-placement' => 'top',
|
||||
'title' => $this->lang->line('config_image_max_height_tooltip')));
|
||||
@@ -177,7 +177,7 @@
|
||||
'type' => 'number',
|
||||
'min' => 128,
|
||||
'max' => 2048,
|
||||
'value' => $this->config->item('max_image_size'),
|
||||
'value' => $this->config->item('image_max_size'),
|
||||
'data-toggle' => 'tooltip',
|
||||
'data-placement' => 'top',
|
||||
'title' => $this->lang->line('config_image_max_size_tooltip')));
|
||||
|
||||
Reference in New Issue
Block a user