<?php if (!defined('IN_ROSTER')) { exit('Detected invalid access to this file!'); } include_once $addon['inc_dir'] . 'functions.lib.php'; $func = new mainFunctions(); if (isset($_POST['op']) && $_POST['op'] == 'upload') { $filename = basename($_FILES['b_image']['name']); $target_path = $addon['dir'] . 'images' . DIR_SEP . basename($_FILES['b_image']['name']); $path = $addon['dir'] . 'images' . DIR_SEP; $slider = $path . 'slider-' . $filename; $thumb = $path . 'thumb-' . $filename; if (move_uploaded_file($_FILES['b_image']['tmp_name'], $target_path)) { $func->image_resize($target_path, $thumb, 100, 47); $func->image_resize($target_path, $slider, 600, 300); $query = "INSERT INTO `" . $roster->db->table('slider', $addon['basename']) . "` SET " . "`b_title` = '" . $_POST['b_title'] . "', " . "`b_desc` = '" . $_POST['b_desc'] . "', " . "`b_url` = '" . $_POST['b_url'] . "', " . "`b_video` = '" . $_POST['b_video'] . "', " . "`b_image` = '" . $_FILES['b_image']['name'] . "';"; if ($roster->db->query($query)) { $roster->set_message(sprintf($roster->locale->act['slider_add_success'], $_FILES['b_image']['name'])); } else { unlink($target_path); unlink($slider); unlink($thumb); $roster->set_message($roster->locale->act['slider_error_db'], '', 'error'); $roster->set_message('<pre>' . $roster->db->error() . '</pre>', 'MySQL Said', 'error'); } } else { $roster->set_message(sprintf($roster->locale->act['slider_file_error'], $target_path), $roster->locale->act['b_add'], 'error'); } //*/ }
$total = $roster->db->num_rows($resultsb); $slider_js = array(); $x = $y = ''; while ($rowb = $roster->db->fetch($resultsb)) { if ($total == $num) { $e = true; } else { $e = false; } if ($num == 1) { $x = $rowb['b_title']; $y = $rowb['b_desc']; } $target_path = $addon['dir'] . 'images/' . $rowb['b_image']; if (!file_exists($addon['dir'] . 'images/slider-' . $rowb['b_image'])) { $func->image_resize($target_path, $addon['dir'] . 'images/slider-' . $rowb['b_image'], 600, 300); } if (!file_exists($addon['dir'] . 'images/thumb-' . $rowb['b_image'])) { $func->image_resize($target_path, $addon['dir'] . 'images/thumb-' . $rowb['b_image'], 100, 47); } $roster->tpl->assign_block_vars('slider', array('DESC' => $rowb['b_desc'], 'URL' => $rowb['b_url'], 'IMAGE' => $addon['url_path'] . 'images/slider-' . $rowb['b_image'], 'TIMAGE' => $addon['url_path'] . 'images/thumb-' . $rowb['b_image'], 'ID' => $rowb['b_id'], 'TITLE' => $rowb['b_title'], 'IS_VIDEO' => $rowb['b_video'], 'NUM' => $num, 'NUMX' => $num - 1, 'END' => $e, 'TOTAL' => $total)); $num++; } $camera_js_config = array(); $camera_js_config2 = array(); foreach ($addon['config'] as $key => $value) { if (strpos($key, 'slider_') !== 0 || $key == 'slider_skin') { continue; } $key = str_replace('slider_', '', $key); if (!is_numeric($value) && $value != 'true' && $value != 'false') {