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

[eluser]Devon Lambert[/eluser]
Just out of curiosity Phil, is PyroCMS using any particular Authentication library? OR does it use a custom built one?

Just curious and haven't had a chance to dive into the code yet, so thought I'd ask.

[eluser]Phil Sturgeon[/eluser]
A custom built one but it is fairly standard stuff. It should be pretty secure but I am sure it has lots of room for improvement.

[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

[eluser]Phil Sturgeon[/eluser]
Epic post! I started reading this on my iPhone, that was a mistake. :-)

Thanks for your feedback. I recently created the core_modules folder to store modules that should always be there, and clearly overlooked quite a few things.

Tonight I am off on a 9 mile hike which will take up my entire 17:00-sleep but I will definitely get on these soon.

It would be great if you could create issues for these - and any other bugs you might spot - on the GitHub page (link in my signature) or better yet join the team!

You clearly have an eye for bugs and have no problem getting around a completely undocumented system. It would be great to have you aboard.

[eluser]Turv[/eluser]
[quote author="Phil Sturgeon" date="1249589904"]Epic post! I started reading this on my iPhone, that was a mistake. :-)

Thanks for your feedback. I recently created the core_modules folder to store modules that should always be there, and clearly overlooked quite a few things.

Tonight I am off on a 9 mile hike which will take up my entire 17:00-sleep but I will definitely get on these soon.

It would be great if you could create issues for these - and any other bugs you might spot - on the GitHub page (link in my signature) or better yet join the team!

You clearly have an eye for bugs and have no problem getting around a completely undocumented system. It would be great to have you aboard.[/quote]

Hey,

Thanks - I would welcome the opportunity to help progress this Content Management System further, I will be using this CMS for all upcoming projects that require Codeigniter so will certainly will be expanding what you have already developed!

I've almost finished developing the User Specific permissions so i will post up the code for that should you want to have a look and potentially include it.

Will keep updating my progress with the CMS, Updates, Changes etc in this thread.

What would be great though for the people who use this is for an area where people can submit their own Modules, does that already exist for this project?

What i next intend to work on is the ability to Install and Uninstall modules with ease, like having an install.sql / uninstall.sql etc. Another update i made earlier was having a 'Sort Order' on the modules so that i could sort them in a specific order in the Sidebar, Having the most important modules at the top such as Pages, Products, and having the Core Modules last.

[eluser]Phil Sturgeon[/eluser]
Ok before you start too much down the lines of module installation etc, I already have a sweet plan for this.

Using my REST Server and REST Client CodeIgniter packages I plan to offer up a list of available modules from http://pyrocms.com/ in a sort of "App Store" fashion. These have install SQL in the REST along with other details like author, version, name, description, etc.

They will be browseable within a "client" module on ech PyroCMS installation then a ZIP file will download and the install can be run. It will also be able to tell when an update is available by comparing the details in the local JSON file for each module with the REST versions available.

As for keeping track of other changes, if you are a fan of Git (or wish to learn) I would reccomend you sign up to GitHub and have a play. Three options, 1.) you can fork the repo and I will just cherrypick commits that look good, 2.) you could make a branch in the main repo and i will just merge in things we all agree on, 3.) stick to planned discussed features and put them right into the master.

The first two options let you maintain your own version with all the things you think PyroCMS should have, the last option lets us keep one single version. Up to your of course, it is all open source! ;-)

[eluser]Turv[/eluser]
Your idea for the module installation sounds brilliant!

It's very similar to what Magento do, but instead of browsing the modules from the PyroCMS Installation itself, you would browse all the the modules on the PyroCMS Website and just get an 'Application Key'.

The Application Keys look something like this:

Code:
module-type/module_name_version_md5

Example:

Code:
pyro-community/Products_Module_1.2_a5j8fd

The MD5 substring is there just to make sure there are no duplicates, You would enter this Application Key into your PyroCMS Installation and it would download the module as you described above.

I have never used GitHub, I'm the only developer in my company so never used anything like it, but i will sign up and try and figure it all out.

[eluser]Phil Sturgeon[/eluser]
Well luckily with REST they can do it all on their end, no browsing other sites or faffing with dev keys. It also means I can make the "app store" module available and other people can set up repo's.

If only I had time for all this!

Anyway I have added you to GitHub. Please do not commit willynilly, but for now just stick to issues until we have had a talk.

We need to discuss the module issue, currently I have it only looking at the actual 'modules' directory to stop core modules showing up on the main sidebar list. We can probably avoid this by replacing the module listing in left nav with a glob(APPPATH .'/modules/*/details.xml').

Tbh all of that sidebar module code needs sorting out anyway so if you want to have a crack at that along with your ordering code (in a branch!!) that would be sweet.

[eluser]Turv[/eluser]
Yeah, i'm still trying to figure out this Github thing, never used it before so not even sure what fork's or branches are at the moment! Hah.

I will have a look at the outstanding issues on Github anyway.

I've got my User Specific permissions working, needs some real testing done on it before the code is used but have not come across any problems so far!

[eluser]Phil Sturgeon[/eluser]
Great. If you could change the README on your fork to show that project is just your playground, then it would be very handy.

A Fork is a total copy of a project that shares a history.

A Branch is a temporary copy of a project within the same repository that will most likely be merged back into the main codebase.

If you use your fork for testing out crazy ideas or keeping track of your own work that wont be heading into PyroCMS, then you can contribute changes that WILL be making it into PyroCMS to the main project.

This make any sense?

I can't see it being too much of an issue, I love contributions and as long as its a good idea (and the guys don't mind) im normally fine with it. :-)




Theme © iAndrew 2016 - Forum software by © MyBB