Esempio n. 1
0
    if ($Piverr > 0) {
        $setupstepn = 1;
        $Setupstep1[0][4] = $Pivot_Vars['username'];
        $Setupstep1[3][4] = $Pivot_Vars['email'];
        $Setupstep1[4][5] = $Pivot_Vars['nick'];
    } else {
        $setupstepn = 2;
        $Users[$Pivot_Vars['username']]['pass'] = md5($Pivot_Vars['pass1']);
        $Users[$Pivot_Vars['username']]['email'] = $Pivot_Vars['email'];
        $Users[$Pivot_Vars['username']]['nick'] = $Pivot_Vars['nick'];
        $Users[$Pivot_Vars['username']]['userlevel'] = 1;
        $Users[$Pivot_Vars['username']]['language'] = $Cfg['deflang'];
        $Cfg['users'] .= '|' . $Pivot_Vars['username'];
        // set the categories.,
        if (!isset($selfreg_cats)) {
            $selfreg_cats = cfg_getarray('cats');
        }
        foreach ($selfreg_cats as $category) {
            // add the user..
            $allowed_users = explode("|", $Cfg['cat-' . $category]);
            $allowed_users[] = $Pivot_Vars['username'];
            $allowed_users = array_unique($allowed_users);
            $Cfg['cat-' . $category] = implode("|", $allowed_users);
        }
        PutUserInfo();
    }
}
$var = "Setupstep{$setupstepn}";
if ($setupstepn == 1) {
    $next = lang('general', 'go');
} else {
Esempio n. 2
0
/**
 * Delete a category, then show see_categories again. this function now also removes
 * deleted categories from the 'cat-searchexclusion' array
 *
 * @see see_categories()
 */
function delete_category()
{
    global $Cfg, $Pivot_Vars;
    // check against unauthorised direct access.
    check_csrf();
    if ($Pivot_Vars['delete'] != 1) {
        see_categories();
    } elseif ($Pivot_Vars['confirmed'] != 1) {
        $vars = array('category', $Pivot_Vars['cat'], 'delete', 1);
        ConfirmPage(lang('category', 'delete'), $vars, sprintf(lang('category', 'delete_message'), $Pivot_Vars['username']));
    } else {
        $cat_to_del = category_from_para($Pivot_Vars['category']);
        $cats = cfg_getarray('cats');
        foreach ($cats as $cat) {
            if ($cat != $cat_to_del) {
                $cats_to_keep[] = $cat;
            }
        }
        $Cfg['cats'] = implode($cats_to_keep, "|");
        unset($Cfg['cat-' . $cat_to_del]);
        // delete from searchexclusion categories
        if (isset($Cfg['cats-searchexclusion'])) {
            $searchexclusion_arr = explode("|", $Cfg['cats-searchexclusion']);
            if (in_array($cat_to_del, $searchexclusion_arr)) {
                $cats_to_keep = array();
                foreach ($searchexclusion_arr as $cat) {
                    if ($cat != $cat_to_del) {
                        $cats_to_keep[] = $cat;
                    }
                }
                $Cfg['cats-searchexclusion'] = implode($cats_to_keep, "|");
            }
        }
        // delete from non-public categories
        if (isset($Cfg['cats-nonpublic'])) {
            $nonpublic_arr = explode("|", $Cfg['cats-nonpublic']);
            if (in_array($cat_to_del, $nonpublic_arr)) {
                $cats_to_keep = array();
                foreach ($nonpublic_arr as $cat) {
                    if ($cat != $cat_to_del) {
                        $cats_to_keep[] = $cat;
                    }
                }
                $Cfg['cats-nonpublic'] = implode($cats_to_keep, "|");
            }
        }
        // delete from hidden categories
        if (isset($Cfg['cats-hidden'])) {
            $hidden_arr = explode("|", $Cfg['cats-hidden']);
            if (in_array($cat_to_del, $hidden_arr)) {
                $cats_to_keep = array();
                foreach ($hidden_arr as $cat) {
                    if ($cat != $cat_to_del) {
                        $cats_to_keep[] = $cat;
                    }
                }
                $Cfg['cats-hidden'] = implode($cats_to_keep, "|");
            }
        }
        see_categories();
    }
}
Esempio n. 3
0
function snippet_livearchive_list($filename = "", $format = "", $weblog = "", $template = "")
{
    global $Weblogs, $Current_weblog, $Cfg, $Paths, $allcats;
    if ($filename == "") {
        if ($Cfg['mod_rewrite'] == 0) {
            $filename = $Paths['pivot_url'] . "archive.php";
        } else {
            $filename = $Paths['log_url'] . "category";
        }
    }
    if ($format == "") {
        if ($Cfg['mod_rewrite'] == 0) {
            $format = "<a href='%file%?c=%catid%&amp;w=%weblogid%&amp;t=%template%'>%cat%</a><br />";
        } else {
            $format = "<a href='%file%/%catid%/?w=%weblogid%&amp;t=%template%'>%cat%</a><br />";
        }
    }
    $allcats = cfg_cats();
    if ($weblog == "current") {
        $cats = find_cats_in_weblog($Current_weblog);
        $weblog = $Current_weblog;
    } else {
        if ($weblog != "" && isset($Weblogs[$weblog])) {
            $cats = find_cats_in_weblog($weblog);
        } else {
            // use all cats..
            $cats = cfg_getarray('cats');
        }
    }
    usort($cats, "category_simplesort");
    foreach ($cats as $cat) {
        // skip cat if it's 'not-public'.
        if ($allcats[$cat]['hidden'] == 1) {
            continue;
        }
        // skip if name is empty
        if ($cat == "") {
            continue;
        }
        // skip cat if it doesn't exist anymore
        if (!isset($allcats[$cat])) {
            continue;
        }
        $my_output = $format;
        $my_output = str_replace('%file%', $filename, $my_output);
        $my_output = str_replace('%catid%', para_category($cat), $my_output);
        $my_output = str_replace('%cat%', encode_text($cat), $my_output);
        $my_output = str_replace('%weblogid%', para_weblog($weblog), $my_output);
        $my_output = str_replace('%weblog%', $Weblogs[$weblog]['name'], $my_output);
        $my_output = str_replace('%template%', $template, $my_output);
        // Removing unused/empty weblog (w) and template (t) parameters.
        $my_output = preg_replace('/[wt]=(&amp;|(["\']))/', '\\2', $my_output);
        // And if the URL ends with a question mark, remove it.
        $my_output = preg_replace('#/\\?(["\'])#', '/\\1', $my_output);
        $output .= "\n" . $my_output;
    }
    return $output;
}
Esempio n. 4
0
/**
 * Return $Cfg['cats'] as an array sorted and without empty ones.
 *
 * @return array
 */
function cfg_cats()
{
    global $Cfg;
    $tempArray = cfg_getarray('cats');
    // make the array keyed..
    foreach ($tempArray as $cat) {
        $thisArray[$cat]['name'] = $cat;
    }
    // get the array of order, and clean up the cats-order, while we're at it
    if (isset($Cfg['cats-order'])) {
        $temp_arr = explode("|-|", $Cfg['cats-order']);
        foreach ($temp_arr as $key => $temp_item) {
            list($cat, $order) = explode('|', $temp_item);
            if (isset($thisArray[$cat])) {
                $thisArray[$cat]['order'] = $order;
            } else {
                unset($temp_arr[$key]);
            }
        }
        $Cfg['cats-order'] = implode("|-|", $temp_arr);
    }
    // get the searchexclusions..
    $tempArray = cfg_getarray('cats-searchexclusion');
    foreach ($tempArray as $cat) {
        $thisArray[$cat]['searchexclusion'] = 1;
    }
    // get the public status..
    $tempArray = cfg_getarray('cats-nonpublic');
    foreach ($tempArray as $cat) {
        $thisArray[$cat]['nonpublic'] = 1;
    }
    // get the hidden status..
    $tempArray = cfg_getarray('cats-hidden');
    foreach ($tempArray as $cat) {
        $thisArray[$cat]['hidden'] = 1;
    }
    // get the allowed users..
    foreach ($thisArray as $key => $cat) {
        $thisArray[$key]['allowed'] = cfg_getarray('cat-' . $key);
    }
    // sort them by 'order'
    usort($thisArray, "category_sort");
    // unfortunately, usort destroys the keys.. put back the the keys..
    foreach ($thisArray as $key => $value) {
        unset($thisArray[$key]);
        if ($value['name'] != "") {
            $thisArray[$value['name']] = $value;
        }
    }
    return $thisArray;
}