Skip to content

Commit

Permalink
Modules/admin/controllers/slider.php - General bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
code-path committed Apr 17, 2024
1 parent 5188b1f commit af2e058
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions application/modules/admin/controllers/Slider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function __construct()
$this->load->model('slider_model');

parent::__construct();
require_once('application/libraries/ConfigEditor.php');

require_once('application/libraries/ConfigEditor.php');

requirePermission("viewSlider");
}
Expand All @@ -30,7 +30,7 @@ public function index()

if ($slides) {
foreach ($slides as $key => $value) {
$slides[$key]['image'] = preg_replace("/{path}/", "", $value['image']);
$slides[$key]['image'] = preg_replace("/{image_path}/", "", $value['image']);

if (strlen($slides[$key]['image']) > 15) {
$slides[$key]['image'] = "..." . mb_substr($slides[$key]['image'], strlen($slides[$key]['image']) - 15, 15);
Expand Down Expand Up @@ -75,9 +75,8 @@ public function create()
die("Image can't be empty");
}

if (!preg_match("/http:\/\//", $data['image'])) {
$data['image'] = "{path}" . $data['image'];
}
if(!filter_var($data['image'], FILTER_VALIDATE_URL))
$data['image'] = '{image_path}' . $data['image'];

$this->slider_model->add($data);

Expand Down Expand Up @@ -215,9 +214,8 @@ public function save($id = false)
$data["body"] = $this->input->post("text_body");
$data["footer"] = $this->input->post("text_footer");

if (!preg_match("/http:\/\//", $data['image'])) {
$data['image'] = "{path}" . $data['image'];
}
if(!filter_var($data['image'], FILTER_VALIDATE_URL))
$data['image'] = '{image_path}' . $data['image'];

$this->slider_model->edit($id, $data);

Expand Down

0 comments on commit af2e058

Please sign in to comment.