Mails

What’s going wrong here? I suppose these mails are enogh for one day. Even though the average information content is near zero: bounces…

My inbox today

Wordpress hack … just a note to myself

Hack for classes.php in line 315 (1.5.2). It allows two (sub-)pages to have the same name (slug):

    $temp = dirname(
        str_replace(
            '%2F',
            '/',
            urlencode($q['pagename'])));

    $names = explode('/', $temp);
    $parent = null;

    foreach ($names as $name) {
        $name = sanitize_title($name);
        $query = "SELECT ID " .
            "FROM $wpdb->posts " .
            "WHERE post_name='$name'" .
            (isset($parent) ?
                " AND post_parent=$parent" :
                "");

        $parent = null;
        $parent = $wpdb->get_var($query);

        if (!isset($parent)) {
            // an error occured, continue as normal
            $parent = null;
            break;
        }
    }

    $q['pagename'] = sanitize_title(
        basename(
            str_replace(
                '%2F',
                '/',
                urlencode($q['pagename']))));
    $q['name'] = $q['pagename'];
    $where .=
        " AND post_name = '" .
        $q['pagename'] .
        "'" .
        (isset($parent) ?
            " AND post_parent=$parent" :
            "");

Another hack: allow users with user level >= 5 to edit other user’s posts/pages. This was required for our department’s website. post-functions.php functions-post.php line 352 (1.5.2):

    if ((($user_id == $post_author_data->ID) &&
         !($post->post_status == 'publish' &&
            $author_data->user_level < 2)) ||
         ($author_data->user_level >
             $post_author_data->user_level) ||
         (($author_data->user_level >=
             $post_author_data->user_level) &&
          ($author_data->user_level >= 5)) ||
         ($author_data->user_level >= 10) )
    {
        return true;
    } else {
        return false;
    }

Open Root Server Network

I tentatively switched my nameservers to the Open Root Server Network (OSRN) root servers. Seems to be a promising choice, so let’s give it a try.

You are currently browsing the phbaer blog archives for October, 2005.