$conf['MRP']['randompicture_preload'], 'square' => isset($_POST['square']), ); if (isset($_POST['height'])) $conf['MRP']['height'] = $_POST['height']; else $conf['MRP']['height'] = 0; if (isset($_POST['title'])) $conf['MRP']['title'] = $_POST['title']; else $conf['MRP']['title'] = ''; if (isset($_POST['delay'])) $conf['MRP']['delay'] = $_POST['delay']*1000; else $conf['MRP']['delay'] = 0; if (isset($_POST['apply_to_albums']) and in_array($_POST['apply_to_albums'], array('all', 'list'))) { $conf['MRP']['apply_to_albums'] = $_POST['apply_to_albums']; if ($_POST['apply_to_albums'] == 'list') { check_input_parameter('albums', $_POST, true, PATTERN_ID); if (empty($_POST['albums'])) $_POST['albums'][] = -1; $query = 'UPDATE '.CATEGORIES_TABLE.' SET menurandomphoto_active=\'false\' WHERE id NOT IN ('.implode(',', $_POST['albums']).');'; pwg_query($query); $query = 'UPDATE '.CATEGORIES_TABLE.' SET menurandomphoto_active=\'true\' WHERE id IN ('.implode(',', $_POST['albums']).');'; pwg_query($query); } } conf_update_param('MRP', serialize($conf['MRP'])); $page['infos'][] = l10n('Information data registered in database'); } // make sure we have the extra column (update vs copy new version over old one) $result = pwg_query('SHOW COLUMNS FROM `'.CATEGORIES_TABLE.'` LIKE "menurandomphoto_active";'); if (!pwg_db_num_rows($result)) { $page['errors'][] = l10n('MenuRandomPhoto seems not to be installed/configured properly. Please remove and reinstall.'); return; } // associate to albums $query = 'SELECT id FROM '.CATEGORIES_TABLE.' WHERE menurandomphoto_active=\'true\';'; $mrp_albums = array_from_query($query, 'id'); $query = 'SELECT id,name,uppercats,global_rank FROM '.CATEGORIES_TABLE.';'; display_select_cat_wrapper($query, $mrp_albums, 'album_options'); $template->assign(array('MRP' => $conf['MRP'])); $template->set_filename('plugin_admin_content', realpath(MRP_PATH . 'template/admin.tpl')); $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');