Only fill this in if you're a spammer huh? Your name :
Your email :
Your message :

Category: Hacks

Mar
20th
2008

Playing with a blogrum

Posted in : Techno Babble, Skins, Hacks, Plugins & Widgets

Convincing Evo that it's a forum

On the grounds that it's often easier to show something than try explaining it .....go visit the blogrum. Before you ask, no it's not ready for release yet, I need to sort out some permissions stuff to do with comments and tidy up the code and css ..... cos it's a tad messy in there ..... and then it's gonna take a mammoth post to explain what it can do, how, where, why and when. The good news is that it's pretty much just a trick skin with a couple of plugins thrown in, although I have a few more plugins in the works to make it work even more like a forum.

Registration is open, so if you want to have a play then feel free, although guest users can comment in the chatter blogrum so if all you want to do is spam me then there's no need to even register ;)

¥

Tags: blogrum
1325 views and only 2 comments
Dec
2nd
2006

Clean urls on windoze !!

Posted in : Hacks

Damn it would appear that I've stumbled across a way to get clean urls working on a windoze box. It requires a shedload more testing, but this is the gist of it.

1) Enable a custom 404 for your blog folder ( urm, there's probably summat in your ControlPanel to do it, or just hit IIS huh?) and point it at /[path to blogs]/index.php

2 )Create a conf/hacks.php with the following code :-

Code:

<?php
/*
* Extra Path ? On windows? :O
*/
if( !defined('EVO_CONFIG_LOADED') ) die( 'Please, do not access this page directly.' );
 
if( ( ! isset( $resolve_extra_path ) || $resolve_extra_path ) && is_windows() )
{
  $ReqPath = preg_replace( '#^(.+?):80([^?]+?)(\?.+?)*$#', '$2', $ReqURI );
  $ReqURI = preg_replace( '#^(.+?):80(.+?)$#', '$2', $ReqURI );
}
?>

3) Turn extra path on in admin ..... kinda helps

That's it, extra path should now work!

¥

415 views and only you can be the first to comment
Nov
27th
2006

Control your children

Posted in : Hacks

This is a fix to move a categories children when you move the category. It should work in all 1.8/1.9 versions and is already fixed in 2.0

inc/model/collectons/_category.funcs.php, find this bit of code :-

Code:

/**
* Update a category
*
* This funtion has to handle all needed DB dependencies!
*/
function cat_update(
  $cat_ID,
  $cat_name,
  $cat_parent_ID = 0,
  $cat_blog_ID = '' )
{
  global $DB;
 
  if( $cat_parent_ID == 0 ) $cat_parent_ID = 'NULL';
 
  return $DB->query( "UPDATE T_categories
                        SET cat_name = ".$DB->quote($cat_name).",
                            cat_parent_ID = $cat_parent_ID ".
                            (!empty($cat_blog_ID) ? ", cat_blog_ID = $cat_blog_ID" : '')."
                      WHERE cat_ID = $cat_ID" );
}

and replace it with this :-

Code:

/**
* Update a category
*
* This funtion has to handle all needed DB dependencies!
*/
function cat_update(
  $cat_ID,
  $cat_name,
  $cat_parent_ID = 0,
  $cat_blog_ID = '' )
{
  global $DB;
 
  if ( !empty( $cat_blog_ID ) )
  {// lets move any/all children
    cat_movechildren( $cat_ID, $cat_blog_ID );
  }
 
  if( $cat_parent_ID == 0 ) $cat_parent_ID = 'NULL';
 
  return $DB->query( "UPDATE T_categories
                        SET cat_name = ".$DB->quote($cat_name).",
                            cat_parent_ID = $cat_parent_ID ".
                            (!empty($cat_blog_ID) ? ", cat_blog_ID = $cat_blog_ID" : '')."
                      WHERE cat_ID = $cat_ID" );
}
 
 
/**
* Recursively move a categories children
*/
function cat_movechildren( $cat_ID, $cat_blog_ID )
{
  global $DB;
  $sql = 'select cat_ID from T_categories where cat_parent_ID = '.$cat_ID;
  $results = $DB->get_results( $sql, ARRAY_A );
  if( $results )
  {
    foreach( $results as $record )
    {
      // first lets move the category
      $sql = 'update T_categories
                set cat_blog_ID = '.$cat_blog_ID.'
                where cat_ID = '.$record[ 'cat_ID' ];
      $DB->query( $sql );
      // now lets move any children of this child
      cat_movechildren( $record[ 'cat_ID' ], $cat_blog_ID );
    }
  }
}

¥

244 views and only you can be the first to comment
Nov
26th
2006

Comments from registered members only

Posted in : Hacks

This hack has now been replaced with a plugin

Backup any files that you play with first huh?

_feedback.php

Find this bit of code :-

Code:

// Comment form:
  if( $disp_comment_form && $Item->can_comment() )
  { // We want to display the comments form and the item can be commented on:

and replace it with this bit of code :-

Code:

if( is_logged_in() )
{
  $Item->comment_status = 'open';
}
else
{
  $Item->comment_status = 'closed';
  echo '<h4>Sorry, you need to be a registered member to leave a comment</h4>';
}
 
 
 
  // Comment form:
  if( $disp_comment_form && $Item->can_comment( NULL) )
  { // We want to display the comments form and the item can be commented on:
htsrv/comment_post.php

Find this bit of code :-

Code:

// Getting GET or POST parameters:
param( 'comment_post_ID', 'integer', true ); // required
 
$commented_Item = & $ItemCache->get_by_ID( $comment_post_ID );
 
if( ! $commented_Item->can_comment( NULL ) )
{
  $Messages->add( T_('You cannot leave comments on this post!'), 'error' );
}

and replace it with this :-

Code:

// Getting GET or POST parameters:
param( 'comment_post_ID', 'integer', true ); // required
 
$commented_Item = & $ItemCache->get_by_ID( $comment_post_ID );
 
if( is_logged_in() )
{
  $commented_Item->comment_status = 'open';
}
else
{
  $commented_Item->comment_status = 'closed';
}
 
if( ! $commented_Item->can_comment( NULL ) )
{
  $Messages->add( T_('Sorry, you need to be a registered member to leave a comment'), 'error' );
}
inc/model/items/_item.class.php (optional)

Find this line (approx 456 in 1.9beta and line 402 in 1.8.5 and probably somewhere in the 400's for other versions) and change the open to closed

Code:

if( $Request->param( 'post_comment_status', 'string', 'closed' ) !== NULL )

¥

440 views and only 2 comments