Welcome Guest, Not a member yet? Register   Sign In
PyroCMS v0.9.7.4 - an open-source modular general purpose CMS

[eluser]Turv[/eluser]
Hey,

First of all Phill...Thanks for this brilliant CMS. I love because it allows me to develop on top of it which is exactly why i chose codeigniter.

I've come across a number of bugs while i've been working with it that i've fixed all myself, foolishly not thinking to post them up here for them to be fixed in the main release.

I will be posting in this thread as and when i find the bugs as well with the fix (If i am able to fix them, that is).

Well..the first bug i came across a few minutes ago with the Permissions was that when someone who does not have access to a page in the Admin Panel they are returned with an ugly error saying solely 'An error has occured', this does not tell the user anything mainly because in the Admin Controller the message is passed to the error page before the language is loaded.

Code:
// Show error and exit if the user does not have sufficient permissions
        if( ! $allow_access )
        {
              show_error($this->lang->line('cp_access_denied'));
            exit;
        }

Just after this the language files are loaded resulting in a blank message being passed to the show_error handler.

The fix is to load the language files before the show_error function is called (Should it be called that is).

Code:
// Load the Language files ready for output
        $this->lang->load('admin');
        $this->lang->load('main');

        // Show error and exit if the user does not have sufficient permissions
        if( ! $allow_access )
        {
              show_error($this->lang->line('cp_access_denied'));
            exit;
        }

Another bug i found was with the core modules, If you go to the Settings / Theme / Permissions none of the module data (From the details.xml file) is loaded, therefore the Page Titles are at their default 'Control Panel'.

And because there is no module data the options such as 'Add role' in the permissions area, or 'Upload Theme' in the Themes area do not load.

This is because if you go into the matchbox helper and look at the module_directories() function

Code:
function module_directories() {
        $CI =& get_instance();
        
        //return $CI->matchbox->directory_array();
        
        /* What the shit is going on here? Well, i'll explain!
...
         */
        
        return array('modules');
    }

For some reason the functioning code has been commented out, instead it tells the system basically that all the modules are in the modules folder and not to look elsewhere.

Whilst looking back through previous versions i got confused because recently it seems that you may have decided to store all the modules together and not have a core_modules folder, thus the above code works, but then it appears as though you changed back to having a core_modules folder, maybe forgetting to change the above code?

If anyone experiences problems with the above just change the function to this..

Code:
function module_directories() {
        $CI =& get_instance();
        return $CI->matchbox->directory_array();
    }

The final one that i remember was on the Permissions area, if you go to Add new Rule, and select either Role or User, nothing happens...This is because it is trying to include a Javascript file that does not exist in the location it think's its in.

Code:
[removed][removed]

As per what i said above, i think you may have at somepoint decided to consolidate all of the modules on one folder, and then reverted back, so whilst this would have worked in one of the last versions, now that the permissions module is in the core_module folder the file returns a 404.

What i did to fix this (Maybe not the best way..I'm still learning the system, only been playing with it for a few hours)

In the Libraries/Assets.php you have the following function

Code:
function _other_asset_location($asset_name, $module_name = NULL, $asset_type = NULL, $location_type = 'url')
    {

// ....Removed code above to save space on the post
        
        // Normal file (that might be in a module)
        else
        {
            $asset_location = $base_location;
        
            // Its in a module, ignore the current
            if($module_name) {
                $asset_location .= 'modules/'.$module_name.'/';
            } else {
                $asset_location .= 'assets/';
            }
            
            $asset_location .= $asset_type.'/'.$asset_name;
        }
        
        return $asset_location;
    
    }

The problem occurs here:
Code:
if($module_name) {
                $asset_location .= 'modules/'.$module_name.'/';
            } else {
                $asset_location .= 'assets/';
            }

It basically says if it's a module it is going to be in the modules directory, which it may not if its a core module, so what i did was below.

Code:
if($module_name) {
                if(file_exists(APPPATH . 'core_modules/'.$module_name.'/' . $asset_type . '/' . $asset_name))
                    $asset_location .= 'core_modules/'.$module_name.'/';
                else                
                    $asset_location .= 'modules/'.$module_name.'/';    
                    
            } else {
                $asset_location .= 'assets/';
            }

That basically checks first to see if the Asset is existant in the core_modules, if isn't then it is assumed it is in the modules directory.

Unfortunatley i was not thinking when i fixed my earlier bugs so i cannot remember what they were, but should i remember i


Messages In This Thread
PyroCMS v0.9.7.4 - an open-source modular general purpose CMS - by El Forum - 08-06-2009, 08:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB