function theme_activate($id, $version, &$errors) { global $conf; include_once dirname(dirname(__FILE__)) . '/functions.inc.php'; $default_conf = modus_get_default_config(); $my_conf = @$conf['modus_theme']; $my_conf = @unserialize($my_conf); if (empty($my_conf)) { $my_conf = $default_conf; } $my_conf = array_merge($default_conf, $my_conf); $my_conf = array_intersect_key($my_conf, $default_conf); conf_update_param('modus_theme', addslashes(serialize($my_conf))); }
<?php if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); } global $template; include_once dirname(dirname(__FILE__)) . '/functions.inc.php'; $default_conf = modus_get_default_config(); load_language('theme.lang', dirname(__FILE__) . '/../'); $my_conf = @$conf['modus_theme']; if (!isset($my_conf)) { $my_conf = $default_conf; } elseif (!is_array($my_conf)) { $my_conf = unserialize($my_conf); $my_conf = array_merge($default_conf, $my_conf); } $text_values = array('skin', 'album_thumb_size', 'index_photo_deriv', 'index_photo_deriv_hdpi'); $bool_values = array('display_page_banner'); // *************** POST management ******************** if (isset($_POST[$text_values[0]])) { foreach ($text_values as $k) { $my_conf[$k] = stripslashes($_POST[$k]); } foreach ($bool_values as $k) { $my_conf[$k] = isset($_POST[$k]) ? true : false; } if (!isset($_POST['use_album_square_thumbs'])) { $my_conf['album_thumb_size'] = 0; } // int/double $my_conf['album_thumb_size'] = max(0, $my_conf['album_thumb_size']);