Example #1
0
/**
* Saves the global configuration to all albums
*
* @return   string              HTML
*
*/
function MG_saveGlobalAlbumAttr()
{
    global $_USER, $_CONF, $_TABLES, $_MG_CONF, $LANG_MG00, $LANG_MG01;
    if (!SEC_hasRights('mediagallery.admin')) {
        COM_errorLog("Media Gallery user attempted to edit global album attributes without proper accss.");
        return COM_showMessageText($LANG_MG00['access_denied_msg']);
    }
    $startaid = COM_applyFilter($_POST['startaid'], true);
    $A['enable_comments'] = isset($_POST['enable_comments']) ? COM_applyFilter($_POST['enable_comments'], true) : 0;
    $A['exif_display'] = isset($_POST['enable_exif']) ? COM_applyFilter($_POST['enable_exif'], true) : 0;
    $A['enable_rating'] = isset($_POST['enable_rating']) ? COM_applyFilter($_POST['enable_rating'], true) : 0;
    $A['rsschildren'] = isset($_POST['rsschildren']) ? COM_applyFilter($_POST['rsschildren'], true) : 0;
    $A['podcast'] = isset($_POST['podcast']) ? COM_applyFilter($_POST['podcast'], true) : 0;
    $A['mp3ribbon'] = isset($_POST['mp3ribbon']) ? COM_applyFilter($_POST['mp3ribbon'], true) : 0;
    $A['playback_type'] = isset($_POST['playback_type']) ? COM_applyFilter($_POST['playback_type'], true) : 0;
    $A['enable_slideshow'] = isset($_POST['enable_slideshow']) ? COM_applyFilter($_POST['enable_slideshow'], true) : 0;
    $A['enable_random'] = isset($_POST['enable_random']) ? COM_applyFilter($_POST['enable_random'], true) : 0;
    $A['enable_views'] = isset($_POST['enable_views']) ? COM_applyFilter($_POST['enable_views'], true) : 0;
    $A['enable_keywords'] = isset($_POST['enable_keywords']) ? COM_applyFilter($_POST['enable_keywords'], true) : 0;
    $A['enable_sort'] = isset($_POST['enable_sort']) ? COM_applyFilter($_POST['enable_sort'], true) : 0;
    $A['albums_first'] = isset($_POST['albums_first']) ? COM_applyFilter($_POST['albums_first'], true) : 0;
    $A['tn_size'] = isset($_POST['tn_size']) ? COM_applyFilter($_POST['tn_size'], true) : 0;
    $A['tn_height'] = isset($_POST['tnheight']) ? COM_applyFilter($_POST['tnheight'], true) : 200;
    $A['tn_width'] = isset($_POST['tnwidth']) ? COM_applyFilter($_POST['tnwidth'], true) : 200;
    if ($A['tn_height'] == 0) {
        $A['tn_height'] = 200;
    }
    if ($A['tn_width'] == 0) {
        $A['tn_width'] = 200;
    }
    $A['display_rows'] = isset($_POST['display_rows']) ? COM_applyFilter($_POST['display_rows'], true) : 0;
    $A['display_columns'] = isset($_POST['display_columns']) ? COM_applyFilter($_POST['display_columns'], true) : 0;
    $A['full_display'] = isset($_POST['full_display']) ? COM_applyFilter($_POST['full_display'], true) : 0;
    $A['max_image_height'] = isset($_POST['max_image_height']) ? COM_applyFilter($_POST['max_image_height'], true) : 0;
    $A['max_image_width'] = isset($_POST['max_image_width']) ? COM_applyFilter($_POST['max_image_width'], true) : 0;
    $A['max_filesize'] = isset($_POST['max_filesize']) ? COM_applyFilter($_POST['max_filesize'], true) : 0;
    $A['display_image_size'] = isset($_POST['display_image_size']) ? COM_applyFilter($_POST['display_image_size'], true) : 0;
    $A['enable_album_views'] = isset($_POST['enable_album_views']) ? COM_applyFilter($_POST['enable_album_views'], true) : 0;
    $A['enable_rss'] = isset($_POST['enable_rss']) ? COM_applyFilter($_POST['enable_rss'], true) : 0;
    $A['allow_download'] = isset($_POST['allow_download']) ? COM_applyFilter($_POST['allow_download'], true) : 0;
    $A['display_album_desc'] = isset($_POST['display_album_desc']) ? COM_applyFilter($_POST['display_album_desc'], true) : 0;
    $A['filename_title'] = isset($_POST['filename_title']) ? COM_applyFilter($_POST['filename_title'], true) : 0;
    $A['image_skin'] = COM_applyFilter($_POST['skin']);
    $A['album_skin'] = COM_applyFilter($_POST['askin']);
    $A['display_skin'] = COM_applyFilter($_POST['dskin']);
    $A['skin'] = COM_applyFilter($_POST['album_theme']);
    // valid media formats....
    $format_jpg = isset($_POST['format_jpg']) ? COM_applyFilter($_POST['format_jpg'], true) : 0;
    $format_png = isset($_POST['format_png']) ? COM_applyFilter($_POST['format_png'], true) : 0;
    $format_tif = isset($_POST['format_tif']) ? COM_applyFilter($_POST['format_tif'], true) : 0;
    $format_gif = isset($_POST['format_gif']) ? COM_applyFilter($_POST['format_gif'], true) : 0;
    $format_bmp = isset($_POST['format_bmp']) ? COM_applyFilter($_POST['format_bmp'], true) : 0;
    $format_tga = isset($_POST['format_tga']) ? COM_applyFilter($_POST['format_tga'], true) : 0;
    $format_psd = isset($_POST['format_psd']) ? COM_applyFilter($_POST['format_psd'], true) : 0;
    $format_mp3 = isset($_POST['format_mp3']) ? COM_applyFilter($_POST['format_mp3'], true) : 0;
    $format_ogg = isset($_POST['format_ogg']) ? COM_applyFilter($_POST['format_ogg'], true) : 0;
    $format_asf = isset($_POST['format_asf']) ? COM_applyFilter($_POST['format_asf'], true) : 0;
    $format_swf = isset($_POST['format_swf']) ? COM_applyFilter($_POST['format_swf'], true) : 0;
    $format_mov = isset($_POST['format_mov']) ? COM_applyFilter($_POST['format_mov'], true) : 0;
    $format_mp4 = isset($_POST['format_mp4']) ? COM_applyFilter($_POST['format_mp4'], true) : 0;
    $format_mpg = isset($_POST['format_mpg']) ? COM_applyFilter($_POST['format_mpg'], true) : 0;
    $format_zip = isset($_POST['format_zip']) ? COM_applyFilter($_POST['format_zip'], true) : 0;
    $format_other = isset($_POST['format_other']) ? COM_applyFilter($_POST['format_other'], true) : 0;
    $format_flv = isset($_POST['format_flv']) ? COM_applyFilter($_POST['format_flv'], true) : 0;
    $format_rflv = isset($_POST['format_rflv']) ? COM_applyFilter($_POST['format_rflv'], true) : 0;
    $format_emb = isset($_POST['format_emb']) ? COM_applyFilter($_POST['format_emb'], true) : 0;
    $comment_active = isset($_POST['comment_active']) ? COM_applyFilter($_POST['comment_active'], true) : 0;
    $exif_active = isset($_POST['exif_active']) ? COM_applyFilter($_POST['exif_active'], true) : 0;
    $rating_active = isset($_POST['rating_active']) ? COM_applyFilter($_POST['rating_active'], true) : 0;
    $rsschildren_active = isset($_POST['rsschildren_active']) ? COM_applyFilter($_POST['rsschildren_active'], true) : 0;
    $podcast_active = isset($_POST['podcast_active']) ? COM_applyFilter($_POST['podcast_active'], true) : 0;
    $mp3ribbon_active = isset($_POST['mp3ribbon_active']) ? COM_applyFilter($_POST['mp3ribbon_active'], true) : 0;
    $playback_active = isset($_POST['playback_active']) ? COM_applyFilter($_POST['playback_active'], true) : 0;
    $slideshow_active = isset($_POST['slideshow_active']) ? COM_applyFilter($_POST['slideshow_active'], true) : 0;
    $random_active = isset($_POST['random_active']) ? COM_applyFilter($_POST['random_active'], true) : 0;
    $shutterfly_active = isset($_POST['shutterfly_active']) ? COM_applyFilter($_POST['shutterfly_active'], true) : 0;
    $views_active = isset($_POST['views_active']) ? COM_applyFilter($_POST['views_active'], true) : 0;
    $keywords_active = isset($_POST['keywords_active']) ? COM_applyFilter($_POST['keywords_active'], true) : 0;
    $sort_active = isset($_POST['sort_active']) ? COM_applyFilter($_POST['sort_active'], true) : 0;
    $afirst_active = isset($_POST['afirst_active']) ? COM_applyFilter($_POST['afirst_active'], true) : 0;
    $thumbnail_active = isset($_POST['thumbnail_active']) ? COM_applyFilter($_POST['thumbnail_active'], true) : 0;
    $tnheight_active = isset($_POST['tnheight_active']) ? COM_applyFilter($_POST['tnheight_active'], true) : 0;
    $tnwidth_active = isset($_POST['tnwidth_active']) ? COM_applyFilter($_POST['tnwidth_active'], true) : 0;
    $rows_active = isset($_POST['rows_active']) ? COM_applyFilter($_POST['rows_active'], true) : 0;
    $columns_active = isset($_POST['columns_active']) ? COM_applyFilter($_POST['columns_active'], true) : 0;
    $full_display_active = isset($_POST['full_display_active']) ? COM_applyFilter($_POST['full_display_active'], true) : 0;
    $max_image_height_active = isset($_POST['max_image_height_active']) ? COM_applyFilter($_POST['max_image_height_active'], true) : 0;
    $max_image_width_active = isset($_POST['max_image_width_active']) ? COM_applyFilter($_POST['max_image_width_active'], true) : 0;
    $max_filesize_active = isset($_POST['max_filesize_active']) ? COM_applyFilter($_POST['max_filesize_active'], true) : 0;
    $display_image_size_active = isset($_POST['display_image_size_active']) ? COM_applyFilter($_POST['display_image_size_active'], true) : 0;
    $album_views_active = isset($_POST['album_views_active']) ? COM_applyFilter($_POST['album_views_active'], true) : 0;
    $enable_rss_active = isset($_POST['enable_rss_active']) ? COM_applyFilter($_POST['enable_rss_active'], true) : 0;
    $allow_download_active = isset($_POST['allow_download_active']) ? COM_applyFilter($_POST['allow_download_active'], true) : 0;
    $display_album_desc_active = isset($_POST['display_album_desc_active']) ? COM_applyFilter($_POST['display_album_desc_active'], true) : 0;
    $formats_active = isset($_POST['formats_active']) ? COM_applyFilter($_POST['formats_active'], true) : 0;
    $filename_title_active = isset($_POST['filename_title_active']) ? COM_applyFIlter($_POST['filename_title_active'], true) : 0;
    $image_skin_active = isset($_POST['image_skin_active']) ? COM_applyFilter($_POST['image_skin_active'], true) : 0;
    $album_skin_active = isset($_POST['album_skin_active']) ? COM_applyFilter($_POST['album_skin_active'], true) : 0;
    $display_skin_active = isset($_POST['display_dkin_active']) ? COM_applyFilter($_POST['display_skin_active'], true) : 0;
    $admin_menu = isset($_POST['admin_menu']) ? COM_applyFilter($_POST['admin_menu'], true) : 0;
    $album_theme_active = isset($_POST['album_theme_active']) ? COM_applyFilter($_POST['album_theme_active'], true) : 0;
    $valid_formats = $format_jpg + $format_png + $format_tif + $format_gif + $format_bmp + $format_tga + $format_psd + $format_mp3 + $format_ogg + $format_asf + $format_swf + $format_mov + $format_mp4 + $format_mpg + $format_zip + $format_other + $format_flv + $format_rflv + $format_emb;
    if ($A['display_rows'] < 1 || $A['display_rows'] > 99) {
        $A['display_rows'] = 4;
    }
    if ($A['display_columns'] < 1 || $A['display_columns'] > 9) {
        $A['display_columns'] = 3;
    }
    $updateSQL = '';
    $updateSQL .= $comment_active ? "enable_comments={$A['enable_comments']}" : '';
    $updateSQL .= $exif_active ? ($updateSQL != '' ? ',' : '') . "exif_display={$A['exif_display']}" : '';
    $updateSQL .= $rating_active ? ($updateSQL != '' ? ',' : '') . "enable_rating={$A['enable_rating']}" : '';
    $updateSQL .= $rsschildren_active ? ($updateSQL != '' ? ',' : '') . "rsschildren={$A['rsschildren']}" : '';
    $updateSQL .= $podcast_active ? ($updateSQL != '' ? ',' : '') . "podcast={$A['podcast']}" : '';
    $updateSQL .= $mp3ribbon_active ? ($updateSQL != '' ? ',' : '') . "mp3ribbon={$A['mp3ribbon']}" : '';
    $updateSQL .= $playback_active ? ($updateSQL != '' ? ',' : '') . "playback_type={$A['playback_type']}" : '';
    $updateSQL .= $slideshow_active ? ($updateSQL != '' ? ',' : '') . "enable_slideshow={$A['enable_slideshow']}" : '';
    $updateSQL .= $random_active ? ($updateSQL != '' ? ',' : '') . "enable_random={$A['enable_random']}" : '';
    $updateSQL .= $views_active ? ($updateSQL != '' ? ',' : '') . "enable_views={$A['enable_views']}" : '';
    $updateSQL .= $keywords_active ? ($updateSQL != '' ? ',' : '') . "enable_keywords={$A['enable_keywords']}" : '';
    $updateSQL .= $sort_active ? ($updateSQL != '' ? ',' : '') . "enable_sort={$A['enable_sort']}" : '';
    $updateSQL .= $afirst_active ? ($updateSQL != '' ? ',' : '') . "albums_first={$A['albums_first']}" : '';
    $updateSQL .= $thumbnail_active ? ($updateSQL != '' ? ',' : '') . "tn_size={$A['tn_size']}" : '';
    $updateSQL .= $tnheight_active ? ($updateSQL != '' ? ',' : '') . "tnheight={$A['tn_height']}" : '';
    $updateSQL .= $tnwidth_active ? ($updateSQL != '' ? ',' : '') . "tnwidth={$A['tn_width']}" : '';
    $updateSQL .= $rows_active ? ($updateSQL != '' ? ',' : '') . "display_rows={$A['display_rows']}" : '';
    $updateSQL .= $columns_active ? ($updateSQL != '' ? ',' : '') . "display_columns={$A['display_columns']}" : '';
    $updateSQL .= $full_display_active ? ($updateSQL != '' ? ',' : '') . "full_display={$A['full_display']}" : '';
    $updateSQL .= $allow_download_active ? ($updateSQL != '' ? ',' : '') . "allow_download={$A['allow_download']}" : '';
    $updateSQL .= $display_album_desc_active ? ($updateSQL != '' ? ',' : '') . "display_album_desc={$A['display_album_desc']}" : '';
    $updateSQL .= $formats_active ? ($updateSQL != '' ? ',' : '') . "valid_formats={$valid_formats}" : '';
    $updateSQL .= $filename_title_active ? ($updateSQL != '' ? ',' : '') . "filename_title={$A['filename_title']}" : '';
    $updateSQL .= $album_theme_active ? ($updateSQL != '' ? ',' : '') . "skin=\"{$A['skin']}\"" : '';
    $updateSQL .= $max_image_height_active ? ($updateSQL != '' ? ',' : '') . "max_image_height={$A['max_image_height']}" : '';
    $updateSQL .= $max_image_width_active ? ($updateSQL != '' ? ',' : '') . "max_image_width={$A['max_image_width']}" : '';
    $updateSQL .= $max_filesize_active ? ($updateSQL != '' ? ',' : '') . "max_filesize={$A['max_filesize']}" : '';
    $updateSQL .= $display_image_size_active ? ($updateSQL != '' ? ',' : '') . "display_image_size={$A['display_image_size']}" : '';
    $updateSQL .= $album_views_active ? ($updateSQL != '' ? ',' : '') . "enable_album_views={$A['enable_album_views']}" : '';
    $updateSQL .= $enable_rss_active ? ($updateSQL != '' ? ',' : '') . "enable_rss={$A['enable_rss']}" : '';
    $updateSQL .= $image_skin_active ? ($updateSQL != '' ? ',' : '') . "image_skin=\"{$A['image_skin']}\"" : '';
    $updateSQL .= $album_skin_active ? ($updateSQL != '' ? ',' : '') . "album_skin=\"{$A['album_skin']}\"" : '';
    $updateSQL .= $display_skin_active ? ($updateSQL != '' ? ',' : '') . "display_skin=\"{$A['display_skin']}\"" : '';
    if ($updateSQL != '') {
        if ($startaid == 0) {
            $sql = "UPDATE {$_TABLES['mg_albums']} SET " . $updateSQL;
            DB_query($sql);
            if ($enable_rss_active) {
                require_once $_CONF['path'] . 'plugins/mediagallery/include/rssfeed.php';
                MG_buildFullRSS();
                MG_GlobalrebuildAllAlbumsRSS(0);
            }
        } else {
            MG_saveGlobalAlbumAttrChildren($startaid, $updateSQL);
            if ($enable_rss_active) {
                require_once $_CONF['path'] . 'plugins/mediagallery/include/rssfeed.php';
                MG_buildFullRSS();
                MG_GlobalrebuildAllAlbumsRSS($startaid);
            }
        }
    }
    if ($admin_menu == 1) {
        echo COM_refresh($_MG_CONF['admin_url'] . 'index.php?msg=11');
    } else {
        echo COM_refresh($_MG_CONF['site_url'] . '/index.php');
    }
    exit;
}
Example #2
0
function MB_saveEditMenuElement()
{
    global $_CONF, $_TABLES, $MenuElementAllowedHTML;
    $filter = sanitizer::getInstance();
    $allowedElements = $filter->makeAllowedElements($MenuElementAllowedHTML);
    $filter->setAllowedElements($allowedElements);
    $filter->setPostmode('html');
    $id = COM_applyFilter($_POST['id'], true);
    $menu_id = COM_applyFilter($_POST['menu']);
    $pid = COM_applyFilter($_POST['pid'], true);
    $label = DB_escapeString($filter->filterHTML($_POST['menulabel']));
    $type = COM_applyFilter($_POST['menutype'], true);
    $target = COM_applyFilter($_POST['urltarget']);
    $menu = menu::getInstance($menu_id);
    if ($type == 0) {
        $type = 1;
    }
    switch ($type) {
        case 2:
            $subtype = COM_applyFilter($_POST['glfunction']);
            break;
        case 3:
            $subtype = COM_applyFilter($_POST['gltype'], true);
            break;
        case 4:
            $subtype = COM_applyFilter($_POST['pluginname']);
            break;
        case 5:
            $subtype = COM_applyFilter($_POST['spname']);
            break;
        case 6:
            $subtype = COM_applyFilter($_POST['menuurl']);
            if (strpos($subtype, "http") !== 0 && strpos($subtype, "%site") === false && $subtype[0] != '#' && rtrim($subtype) != '') {
                $subtype = 'http://' . $subtype;
            }
            break;
        case 7:
            $subtype = COM_applyFilter($_POST['phpfunction']);
            break;
        case 9:
            $subtype = COM_applyFIlter($_POST['topicname']);
            break;
        default:
            $subtype = '';
            break;
    }
    $active = COM_applyFilter($_POST['menuactive'], true);
    $url = '';
    if (isset($_POST['menuurl']) && $_POST['menuurl'] != '') {
        $url = trim(DB_escapeString(COM_applyFilter($_POST['menuurl'])));
        if (strpos($url, "http") !== 0 && strpos($url, "%site") === false && $url[0] != '#' && rtrim($url) != '') {
            $url = 'http://' . $url;
        }
    }
    $group_id = COM_applyFilter($_POST['group'], true);
    $aid = COM_applyFilter($_POST['menuorder'], true);
    $aorder = DB_getItem($_TABLES['menu_elements'], 'element_order', 'id=' . $aid);
    $neworder = $aorder + 1;
    $sql = "UPDATE {$_TABLES['menu_elements']} SET pid=" . (int) $pid . ", element_order=" . (int) $neworder . ", element_label='{$label}', element_type='{$type}', element_subtype='{$subtype}', element_active={$active}, element_url='{$url}', element_target='" . DB_escapeString($target) . "', group_id=" . (int) $group_id . " WHERE id=" . (int) $id;
    DB_query($sql);
    $menu->reorderMenu($pid);
}
Example #3
0
function MG_saveDefaults()
{
    global $_CONF, $_MG_CONF, $_TABLES, $_USER, $_POST;
    $enable_comments = isset($_POST['enable_comments']) ? COM_applyFilter($_POST['enable_comments'], true) : 0;
    $enable_exif = isset($_POST['enable_exif']) ? COM_applyFilter($_POST['enable_exif'], true) : 0;
    $enable_rating = isset($_POST['enable_rating']) ? COM_applyFilter($_POST['enable_rating'], true) : 0;
    $enable_album_views = isset($_POST['enable_album_views']) ? COM_applyFilter($_POST['enable_album_views'], true) : 0;
    $enable_views = isset($_POST['enable_views']) ? COM_applyFilter($_POST['enable_views'], true) : 0;
    $enable_keywords = isset($_POST['enable_keywords']) ? COM_applyFilter($_POST['enable_keywords'], true) : 0;
    $enable_sort = isset($_POST['enable_sort']) ? COM_applyFilter($_POST['enable_sort'], true) : 0;
    $enable_rss = isset($_POST['enable_rss']) ? COM_applyFilter($_POST['enable_rss'], true) : 0;
    $enable_postcard = isset($_POST['enable_postcard']) ? COM_applyFilter($_POST['enable_postcard'], true) : 0;
    $enable_podcast = isset($_POST['podcast']) ? COM_applyFilter($_POST['podcast'], true) : 0;
    $album_sort_order = COM_applyFilter($_POST['album_sort_order'], true);
    $playback_type = COM_applyFilter($_POST['playback_type'], true);
    $enable_slideshow = isset($_POST['enable_slideshow']) ? COM_applyFilter($_POST['enable_slideshow'], true) : 0;
    $enable_random = isset($_POST['enable_random']) ? COM_applyFilter($_POST['enable_random'], true) : 0;
    $albums_first = isset($_POST['albums_first']) ? COM_applyFilter($_POST['albums_first'], true) : 0;
    $enable_shutterfly = isset($_POST['enable_shutterfly']) ? COM_applyFilter($_POST['enable_shutterfly'], true) : 0;
    $full_display = COM_applyFilter($_POST['full_display'], true);
    $tn_size = COM_applyFilter($_POST['tn_size'], true);
    $tn_height = COM_applyFilter($_POST['tnheight'], true);
    $tn_width = COM_applyFilter($_POST['tnwidth'], true);
    $max_image_width = COM_applyFilter($_POST['max_image_width'], true);
    $max_image_height = COM_applyFilter($_POST['max_image_height'], true);
    $max_filesize = COM_applyFilter($_POST['max_filesize'], true);
    $display_image_size = COM_applyFilter($_POST['display_image_size'], true);
    $display_rows = COM_applyFIlter($_POST['display_rows'], true);
    $display_columns = COM_applyFilter($_POST['display_columns'], true);
    $wm_auto = isset($_POST['wm_auto']) ? COM_applyFilter($_POST['wm_auto'], true) : 0;
    $wm_opacity = COM_applyFilter($_POST['wm_opacity'], true);
    $wm_location = COM_applyFilter($_POST['wm_location'], true);
    $wm_id = COM_applyFilter($_POST['wm_id']);
    $uploads = isset($_POST['uploads']) ? COM_applyFilter($_POST['uploads'], true) : 0;
    $moderate = isset($_POST['moderate']) ? COM_applyFilter($_POST['moderate'], true) : 0;
    $email_mod = isset($_POST['email_mod']) ? COM_applyFilter($_POST['email_mod'], true) : 0;
    $mod_id = COM_applyFilter($_POST['mod_id'], true);
    $allow_download = isset($_POST['allow_download']) ? COM_applyFilter($_POST['allow_download'], true) : 0;
    $display_album_desc = isset($_POST['display_album_desc']) ? COM_applyFilter($_POST['display_album_desc'], true) : 0;
    $filename_title = isset($_POST['filename_title']) ? COM_applyFilter($_POST['filename_title'], true) : 0;
    $image_skin = COM_applyFilter($_POST['skin']);
    $album_skin = COM_applyFilter($_POST['askin']);
    $display_skin = COM_applyFilter($_POST['dskin']);
    $mp3ribbon = isset($_POST['mp3ribbon']) ? COM_applyFilter($_POST['mp3ribbon'], true) : 0;
    $rsschildren = isset($_POST['rsschildren']) ? COM_applyFilter($_POST['rsschildren'], true) : 0;
    $album_theme = COM_applyFilter($_POST['album_theme']);
    // Convert array values to numeric permission values
    $tperm_owner = isset($_POST['perm_owner']) ? $_POST['perm_owner'] : 0;
    // admin only
    $tperm_group = isset($_POST['perm_group']) ? $_POST['perm_group'] : 0;
    // admin only
    $tperm_members = isset($_POST['perm_members']) ? $_POST['perm_members'] : 0;
    $tperm_anon = isset($_POST['perm_anon']) ? $_POST['perm_anon'] : 0;
    list($perm_owner, $perm_group, $perm_members, $perm_anon) = SEC_getPermissionValues($tperm_owner, $tperm_group, $tperm_members, $tperm_anon);
    // valid media formats....
    $format_jpg = isset($_POST['format_jpg']) ? COM_applyFilter($_POST['format_jpg'], true) : 0;
    $format_png = isset($_POST['format_png']) ? COM_applyFilter($_POST['format_png'], true) : 0;
    $format_tif = isset($_POST['format_tif']) ? COM_applyFilter($_POST['format_tif'], true) : 0;
    $format_gif = isset($_POST['format_gif']) ? COM_applyFilter($_POST['format_gif'], true) : 0;
    $format_bmp = isset($_POST['format_bmp']) ? COM_applyFilter($_POST['format_bmp'], true) : 0;
    $format_tga = isset($_POST['format_tga']) ? COM_applyFilter($_POST['format_tga'], true) : 0;
    $format_psd = isset($_POST['format_psd']) ? COM_applyFilter($_POST['format_psd'], true) : 0;
    $format_mp3 = isset($_POST['format_mp3']) ? COM_applyFilter($_POST['format_mp3'], true) : 0;
    $format_ogg = isset($_POST['format_ogg']) ? COM_applyFilter($_POST['format_ogg'], true) : 0;
    $format_asf = isset($_POST['format_asf']) ? COM_applyFilter($_POST['format_asf'], true) : 0;
    $format_swf = isset($_POST['format_swf']) ? COM_applyFilter($_POST['format_swf'], true) : 0;
    $format_mov = isset($_POST['format_mov']) ? COM_applyFilter($_POST['format_mov'], true) : 0;
    $format_mp4 = isset($_POST['format_mp4']) ? COM_applyFilter($_POST['format_mp4'], true) : 0;
    $format_mpg = isset($_POST['format_mpg']) ? COM_applyFilter($_POST['format_mpg'], true) : 0;
    $format_zip = isset($_POST['format_zip']) ? COM_applyFilter($_POST['format_zip'], true) : 0;
    $format_other = isset($_POST['format_other']) ? COM_applyFilter($_POST['format_other'], true) : 0;
    $format_flv = isset($_POST['format_flv']) ? COM_applyFilter($_POST['format_flv'], true) : 0;
    $format_rflv = isset($_POST['format_rflv']) ? COM_applyFilter($_POST['format_rflv'], true) : 0;
    $format_emb = isset($_POST['format_emb']) ? COM_applyFilter($_POST['format_emb'], true) : 0;
    $valid_formats = $format_jpg + $format_png + $format_tif + $format_gif + $format_bmp + $format_tga + $format_psd + $format_mp3 + $format_ogg + $format_asf + $format_swf + $format_mov + $format_mp4 + $format_mpg + $format_zip + $format_other + $format_flv + $format_rflv + $format_emb;
    // put any error checking / validation here
    if ($wm_id == 'blank.png') {
        $wm_id = 0;
    } else {
        $wm_id = DB_getItem($_TABLES['mg_watermarks'], 'wm_id', 'filename="' . $wm_id . '"');
    }
    if ($wm_id == '') {
        $wm_id = 0;
    }
    if ($wm_id == 0) {
        $wm_auto = 0;
    }
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_enable_comments','{$enable_comments}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_exif_display','{$enable_exif}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_enable_rating','{$enable_rating}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_playback_type','{$playback_type}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_enable_slideshow','{$enable_slideshow}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_enable_random','{$enable_random}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_enable_shutterfly','{$enable_shutterfly}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_enable_views','{$enable_views}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_enable_keywords','{$enable_keywords}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_enable_album_views','{$enable_album_views}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_enable_sort','{$enable_sort}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_albums_first','{$albums_first}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_full_display','{$full_display}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_tn_size','{$tn_size}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_tn_height','{$tn_height}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_tn_width','{$tn_width}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_display_rows','{$display_rows}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_display_columns','{$display_columns}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_member_uploads','{$uploads}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_moderate','{$moderate}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_email_mod','{$email_mod}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_wm_auto','{$wm_auto}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_wm_id','{$wm_id}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_wm_opacity','{$wm_opacity}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_wm_location','{$wm_location}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_album_sort_order','{$album_sort_order}'");
    if ($max_filesize != 0) {
        $max_filesize = $max_filesize * 1024;
    }
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_max_filesize','{$max_filesize}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_max_image_height','{$max_image_height}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_max_image_width','{$max_image_width}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_display_image_size','{$display_image_size}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_perm_owner','{$perm_owner}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_perm_group','{$perm_group}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_perm_members','{$perm_members}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_perm_anon','{$perm_anon}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_mod_group_id','{$mod_id}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_enable_rss','{$enable_rss}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_enable_postcard','{$enable_postcard}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_allow_download','{$allow_download}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_display_album_desc','{$display_album_desc}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_valid_formats','{$valid_formats}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_filename_title','{$filename_title}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_image_skin','{$image_skin}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_album_skin','{$album_skin}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_display_skin','{$display_skin}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_podcast','{$enable_podcast}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_mp3ribbon','{$mp3ribbon}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_rsschildren','{$rsschildren}'");
    DB_save($_TABLES['mg_config'], "config_name, config_value", "'ad_skin','{$album_theme}'");
    echo COM_refresh($_MG_CONF['admin_url'] . 'index.php?msg=4');
    exit;
}