@Karel
This should be before first div tag:
<?php
require_once 'functions.php';
tatiana_backoffice_menu(__('Settings', 'tatiana'));
?>
<?php
// MANAGE IMAGES
if(Params::getParam('tatiana_images') == 'done') {
$upload_dir_small = osc_themes_path() . 'tatiana/images/small_cat/';
$upload_dir_large = osc_themes_path() . 'tatiana/images/large_cat/';
if (!file_exists($upload_dir_small)) { mkdir($upload_dir_small, 0777, true); }
if (!file_exists($upload_dir_large)) { mkdir($upload_dir_large, 0777, true); }
$count_real = 0;
for ($i=1; $i<=1000; $i++) {
if(isset($_POST['fa-icon' .$i])) {
$fields['fields'] = array('s_icon' => Params::getParam('fa-icon' .$i));
$fields['aFieldsDescription'] = array();
Category::newInstance()->updateByPrimaryKey($fields, $i);
message_ok(__('Font Awesome icon successfully saved for category' . ' <strong>#' . $i . '</strong>' ,'tatiana'));
}
if(isset($_FILES['small' .$i]) and $_FILES['small' .$i]['name'] <> ''){
$file_ext = strtolower(end(explode('.', $_FILES['small' .$i]['name'])));
$file_name = $i . '.' . $file_ext;
$file_tmp = $_FILES['small' .$i]['tmp_name'];
$file_type = $_FILES['small' .$i]['type'];
$extensions = array("png");
if(in_array($file_ext,$extensions )=== false) {
$errors = __('extension not allowed, only allowed extension is .png!','tatiana');
}
if(empty($errors)==true){
move_uploaded_file($file_tmp, $upload_dir_small.$file_name);
message_ok(__('Small image #','tatiana') . $i . __(' uploaded successfully.','tatiana'));
$count_real++;
} else {
message_error(__('There was error when uploading small image #','tatiana') . $i . ': ' .$errors);
}
}
}
$count_real = 0;
for ($i=1; $i<=1000; $i++) {
if(isset($_FILES['large' .$i]) and $_FILES['large' .$i]['name'] <> ''){
$file_ext = strtolower(end(explode('.', $_FILES['large' .$i]['name'])));
$file_name = $i . '.' . $file_ext;
$file_tmp = $_FILES['large' .$i]['tmp_name'];
$file_type = $_FILES['large' .$i]['type'];
$extensions = array("png");
if(in_array($file_ext,$extensions )=== false) {
$errors = __('extension not allowed, only allowed extension for large images is .png!','tatiana');
}
if(empty($errors)==true){
move_uploaded_file($file_tmp, $upload_dir_large.$file_name);
message_ok(__('Large image #','tatiana') . $i . __(' uploaded successfully.','tatiana'));
$count_real++;
} else {
message_error(__('There was error when uploading large image #','tatiana') . $i . ': ' .$errors);
}
}
}
}
?>