$thm->add(); compile_all($thm->theme, $thm->lang, $thm->name); } else { if (isset($_POST['edit'])) { $thm = new fud_theme(); if ($edit == 1) { $thm->name = 'default'; } $thm->sync((int) $_POST['edit']); compile_all($thm->theme, $thm->lang, $thm->name); $edit = ''; } else { if (isset($_GET['rebuild']) && ($data = db_saq('SELECT theme, lang, name FROM ' . $DBHOST_TBL_PREFIX . 'themes WHERE id=' . (int) $_GET['rebuild']))) { compile_all($data[0], $data[1], $data[2]); } else { if (isset($_GET['edit']) && ($c = db_arr_assoc('SELECT * FROM ' . $DBHOST_TBL_PREFIX . 'themes WHERE id=' . $edit))) { foreach ($c as $k => $v) { ${'thm_' . $k} = $v; } $thm_t_default = $c['theme_opt'] & 2; $thm_enabled = $c['theme_opt'] & 1; } else { if (isset($_GET['del']) && (int) $_GET['del'] > 1) { fud_theme::delete((int) $_GET['del']); } else { if (isset($_GET['optimize']) && $is_tok && ($t_name = q_singleval('SELECT name FROM ' . $DBHOST_TBL_PREFIX . 'themes WHERE id=' . (int) $_GET['optimize']))) { /* optimize *.php files */ $path = $WWW_ROOT_DISK . 'theme/' . $t_name; $dir = opendir($path); $path .= '/'; while ($f = readdir($dir)) {
if (isset($_POST['cat_submit'])) { if (!empty($_POST['cat_description'])) { $_POST['cat_description'] = ' - ' . $_POST['cat_description']; } $_POST['cat_cat_opt'] = ($_POST['cat_allow_collapse'] == 'Y' ? 1 : 0) | ($_POST['cat_default_view'] == 'COLLAPSED' ? 0 : 2); unset($_POST['cat_allow_collapse'], $_POST['cat_allow_collapse']); $cat = new fud_cat(); if ($edit) { $cat->sync($edit); $edit = ''; } else { $cat->add($_POST['cat_pos']); rebuild_forum_cat_order(); } } if ($edit && ($c = db_arr_assoc('SELECT name, description, cat_opt FROM ' . $tbl . 'cat WHERE id=' . $edit))) { foreach ($c as $k => $v) { ${'cat_' . $k} = $v; } if ($cat_description && !strncmp($cat_description, ' - ', 3)) { $cat_description = substr($cat_description, 3); } $cat_opt = $c['cat_opt']; } else { $c = get_class_vars('fud_cat'); foreach ($c as $k => $v) { ${'cat_' . $k} = ''; } $cat_pos = 'LAST'; $cat_opt = 3; }
draw_stat('Done: Validating group/forum names (fixed: ' . $i . ' relations)'); draw_stat('Validating group/primary user relations'); $c = uq('SELECT g.id, gm1.id, gm2.id FROM ' . $tbl . 'groups g LEFT JOIN ' . $tbl . 'group_members gm1 ON gm1.group_id=g.id AND gm1.user_id=0 LEFT JOIN ' . $tbl . 'group_members gm2 ON gm2.group_id=g.id AND gm2.user_id=2147483647 WHERE g.id>2 AND g.forum_id>0 AND (gm1.id IS NULL OR gm2.id IS NULL)'); while ($r = db_rowarr($c)) { if (!$r[1]) { $glm[$r[0]][] = 0; } if (!$r[2]) { $glm[$r[0]][] = 2147483647; } } if (isset($glm)) { // make group based on 'primary' 1st group $fld_lst = implode(',', $GLOBALS['__GROUPS_INC']['permlist']); $anon = "'" . implode("', '", db_arr_assoc('SELECT ' . $fld_lst . ' FROM ' . $tbl . 'groups WHERE id=1')) . "'"; $regu = "'" . implode("', '", db_arr_assoc('SELECT ' . $fld_lst . ' FROM ' . $tbl . 'groups WHERE id=2')) . "'"; $fld_lst = str_replace('p_', 'up_', $fld_lst); foreach ($glm as $k => $v) { foreach ($v as $uid) { q('INSERT INTO ' . $tbl . 'group_members (group_id, user_id, ' . $fld_lst . ') VALUES (' . $k . ', ' . $uid . ', ' . (!$uid ? $anon : $regu) . ')'); } } } draw_stat('Done: Validating group/primary user relations'); draw_stat('Rebuilding group leader cache'); $c = q('SELECT DISTINCT(user_id) FROM ' . $tbl . 'group_members WHERE group_members_opt>=131072 AND (group_members_opt & 131072) > 0'); while ($r = db_rowarr($c)) { rebuild_group_ldr_cache($r[0]); } unset($c); draw_stat('Done: Rebuilding group leader cache');
$_POST['frm_forum_opt'] = (int) $_POST['frm_mod_attach'] | (int) $_POST['frm_moderated'] | (int) $_POST['frm_passwd_posting'] | (int) $_POST['frm_tag_style']; $frm = new fud_forum(); if (!$edit) { fud_use('groups_adm.inc', true); fud_use('groups.inc'); $frm->cat_id = $cat_id; $frm->add($_POST['frm_pos']); rebuild_forum_cat_order(); logaction(_uid, 'ADDFORUM', $frm->id); } else { $frm->sync($edit, $cat_id); logaction(_uid, 'SYNCFORUM', $edit); $edit = ''; } } if ($edit && ($c = db_arr_assoc('SELECT * FROM ' . $tbl . 'forum WHERE id=' . $edit))) { foreach ($c as $k => $v) { ${'frm_' . $k} = $v; } } else { $tmp = new fud_forum(); $c = get_object_vars($tmp); foreach ($c as $k => $v) { ${'frm_' . $k} = ''; } /* some default values for new forums */ $frm_pos = 'LAST'; $frm_max_attach_size = floor($max_upload_size / 1024); $frm_message_threshold = '0'; $frm_max_file_attachments = '1'; $frm_forum_opt = 16;