This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
// File cannot be called directly
if ( ! defined('AK_FRAMEWORK') ) {
die (); // Silence is gold.
}
// TODO: Allow to disable entire sections.
require_once ( AK_LIB . '/filesystem.php' );
require_once ( AK_LIB .'/formating.php' );
$palettes = ak_chameleon_palettes();
$settings = ak_theme_option();
if ( 'POST' == $_SERVER['REQUEST_METHOD'] ) {
check_admin_referer('chameleon-theme-settings');
if ( isset($_POST['action']) && 'update' == $_POST['action'] && isset($_POST['settings']) ) {
$settings = stripslashes_deep($_POST['settings']);
$settings = array_merge($this->defaultOptions(), $settings);
$settings['header-image'] = $this->getOption('header-image');
// Upload the header file
include_once ( AK_VENDOR . '/upload/class.upload.php');
if ( isset($_FILES['header-file']) ) {
$handle = new akUpload($_FILES['header-file'], 'aktheme');
if ( $handle->uploaded ) {
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_x = 972;
$handle->file_overwrite = true;
$handle->file_auto_rename = false;
$handle->file_new_name_body = 'theme_head';
$handle->image_convert = 'jpg';
$handle->Process(AK_UPLOAD_DIR);
if ( $handle->processed ) {
$settings['header-image'] = 'theme_head.jpg';
} else {
ak_admin_notify(__('Error', 'aktheme') . ': ' . $handle->error);
}
// Process a miniature for this image. This is a banner width image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_x = 468;
$handle->file_overwrite = true;
$handle->file_auto_rename = false;
$handle->file_new_name_body = 'theme_head_thumb';
$handle->image_convert = 'jpg';
$handle->Process(AK_UPLOAD_DIR);
if ( ! $handle->processed ) {
ak_admin_notify(__('Error creating thumbnail', 'aktheme') . ': ' . $handle->error);
}
}
}
$this->setNewOptions($settings);
ak_admin_notify();
} else { // Missing action or all settings disabled
ak_admin_error('Bad form received or no settings to save.', 'aktheme');
}
}
?>