Beispiel #1
0
    if ($query != '?') {
        $filelink .= substr($query, 0, -1);
    }
    // Redirect
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: {$filelink}");
    exit;
}
// load an entry
if (isset($Pivot_Vars['id'])) {
    execute_hook("display_entry", "pre", $Pivot_Vars['id'], $override_weblog);
    $output = parse_entry($Pivot_Vars['id'], $override_weblog);
    // If registered user, override the other settings..
    if (isset($_COOKIE['piv_reguser'])) {
        list($reg_name, $reg_hash) = explode("|", $Pivot_Cookies['piv_reguser']);
        if (check_user_hash($reg_name, $reg_hash)) {
            $reg_user = load_user($reg_name);
            if ($reg_user['show_address'] == 1) {
                $_COOKIE['piv_email'] = $reg_user['email'];
            } else {
                $_COOKIE['piv_email'] = "";
            }
            $_COOKIE['piv_name'] = $reg_user['name'];
            $_COOKIE['piv_url'] = $reg_user['url'];
        }
    }
    if (count($_COOKIE) > 0) {
        $cookie = @fill_comment_form($_COOKIE['piv_name'], $_COOKIE['piv_email'], $_COOKIE['piv_url'], $_COOKIE['piv_rememberinfo'], $_COOKIE['piv_comment']);
        $cookie = i18n_str_to_utf8($cookie);
        $output = str_replace("</body>", $cookie . "</body>", $output);
    }
function snippet_cookie($name = "")
{
    global $Pivot_Vars, $Pivot_Cookies, $Weblogs, $Current_weblog, $reg_user;
    include_once "modules/module_userreg.php";
    // if we don't use live entries, do _not_ use the cookies..
    if ($Weblogs[$Current_weblog]['live_entries'] == 0) {
        return "";
    }
    // get the cookies in an array..
    if (isset($Pivot_Vars['HTTP_COOKIE']) && !isset($Pivot_Cookies)) {
        foreach (explode(";", $Pivot_Vars['HTTP_COOKIE']) as $cookie) {
            list($key, $value) = explode("=", $cookie);
            $Pivot_Cookies[trim($key)] = urldecode(trim($value));
        }
    }
    // If registered user, override the other settings..
    if (isset($Pivot_Cookies['piv_reguser']) && !isset($reg_user)) {
        list($reg_name, $reg_hash) = explode("|", $Pivot_Cookies['piv_reguser']);
        //debug("reg: $reg_name, $reg_hash");
        if (check_user_hash($reg_name, $reg_hash)) {
            $reg_user = load_user($reg_name);
            if ($reg_user['show_address'] == 1) {
                $Pivot_Cookies['piv_email'] = $reg_user['email'];
            } else {
                $Pivot_Cookies['piv_email'] = "";
            }
            $Pivot_Cookies['piv_name'] = $reg_user['name'];
            $Pivot_Cookies['piv_url'] = $reg_user['url'];
        } else {
            $reg_user = FALSE;
        }
    }
    switch ($name) {
        case 'all':
            echo "<h1>koekies</h1><pre>cookies:";
            print_r($Pivot_Cookies);
            echo "</pre>";
            break;
        case 'name':
            return isset($Pivot_Cookies['piv_name']) ? $Pivot_Cookies['piv_name'] : "";
            break;
        case 'email':
            return isset($Pivot_Cookies['piv_email']) ? $Pivot_Cookies['piv_email'] : "";
            break;
        case 'url':
            return isset($Pivot_Cookies['piv_url']) ? $Pivot_Cookies['piv_url'] : "";
            break;
        case 'remember_yes':
            return isset($Pivot_Cookies['piv_rememberinfo']) ? "checked='checked'" : "";
            break;
        case 'remember_no':
            return isset($Pivot_Cookies['piv_rememberinfo']) ? "" : "checked='checked'";
            break;
        case 'reguser':
            return isset($Pivot_Cookies['piv_reguser']) ? $Pivot_Cookies['piv_reguser'] : "";
            break;
    }
}
Beispiel #3
0
     die;
 } else {
     // we comment !!
     // Check if we're allowed to comment on this entry. 'isset' is needed, because old entries
     // might not have 'allow comments' set to either choice.
     if (isset($entry['allow_comments']) && $entry['allow_comments'] == 0) {
         echo "Spam is not appreciated.";
         logspammer($Pivot_Vars['piv_comment'], "closedcomments");
         die;
     }
     $registered = 0;
     // check if we are TEH REG USER..
     if (strlen($_COOKIE['piv_reguser']) > 4) {
         list($reg_name, $reg_hash) = explode("|", $_COOKIE['piv_reguser']);
         debug("reg: {$reg_name}, {$reg_hash}");
         if (check_user_hash($reg_name, $reg_hash) && $reg_name == $Pivot_Vars['piv_name']) {
             $registered = 1;
         }
     }
     // If magic_quotes_gpc is set, we need to strip slashes..
     if (get_magic_quotes_gpc()) {
         $Pivot_Vars['piv_name'] = stripslashes($Pivot_Vars['piv_name']);
         $Pivot_Vars['piv_email'] = stripslashes($Pivot_Vars['piv_email']);
         $Pivot_Vars['piv_url'] = stripslashes($Pivot_Vars['piv_url']);
         $Pivot_Vars['piv_comment'] = stripslashes($Pivot_Vars['piv_comment']);
     }
     $comment_text = strip_trailing_space($Pivot_Vars['piv_comment']);
     $comment_text = str_replace("\r\n", "\n", $comment_text);
     // CRLF(Win) to LF
     $comment_text = str_replace("\r", "\n", $comment_text);
     // CR(Mac) to LF
Beispiel #4
0
    $override_weblog = find_current_weblog_referer();
}
set_current_weblog($override_weblog);
LoadWeblogLanguage($Weblogs[$Current_weblog]['language']);
ob_start();
// Add lang('commentuser','title') to title?
$input = array_merge($_POST, $_GET);
// convert encoding to UTF-8
i18n_array_to_utf8($input, $dummy_variable);
foreach ($input as $key => $value) {
    $input[$key] = trim($value);
}
$message = "";
if (isset($_COOKIE['piv_reguser'])) {
    list($c_user, $c_hash) = explode("|", $_COOKIE['piv_reguser']);
    if (check_user_hash($c_user, $c_hash)) {
        $user = load_user($c_user);
        if (!isset($input['func'])) {
            $input['func'] = "options";
        }
        //} else {
        //	echo "No";
    }
}
// FIXME / TODO - what if cookies are disabled?
switch ($input['func'] === 0 ? '' : $input['func']) {
    case 'login':
        do_login();
        break;
    case 'options':
        do_show_options();