ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Matchbox RC2

November 25, 2007 2:24pm

Subscribe [65]
  • #211 / Feb 13, 2008 3:41pm

    zdknudsen

    305 posts

    I’m not any good when it comes to licenses either.

    Actually I thought that it was only Matchbox itself that had to remain open-source and not whatever projects it was used in as well (with GPL). However, if this is the case I’ll certainly consider another license. Perhaps letting you chose between both.

    Anyway I’m going to have a closer look at GPL and some other licenses in the next few days.

  • #212 / Feb 13, 2008 4:03pm

    Ethan Dunham

    12 posts

    Zacharias-

    I only posted after reading this post from a perl developer:

    http://encodable.com/tech/blog/2006/02/25/Why_the_GPL_is_Incompatible_with_Commercial_Software

    Apparently when you release software that has GPL’d components, you are required to GPL the entire software system. Can’t just have parts GPL and the rest proprietary.

    From the author of the GPL himself via this page: http://www.interesting-people.org/archives/interesting-people/200001/msg00055.html

    “However, the GPL does forbid use of the code in *proprietary*
    (non-free) software.  The GPL does not allow adding any additional
    restrictions to any program that includes the code.  So any program
    that incorporates the GPL-covered code, whether it be commercial,
    academic, or avocational, must be released as free software.  As a
    whole, it must be released under the GPL (though you can put a more
    lax GPL-compatible license such as X11 on the parts you write, if you
    wish).”

  • #213 / Feb 13, 2008 4:08pm

    zdknudsen

    305 posts

    Well, that settles it. 😊

    Now I just have to settle on which other license to release it under.

  • #214 / Feb 14, 2008 2:52pm

    WolfgangA

    46 posts

    You might want to have a look at the LGPL - i think that would be a good choice.
    Basically it allows to combine components like matchbox, or binaries to be used with commercial sw.

  • #215 / Feb 17, 2008 7:09am

    adamp1

    772 posts

    I was just trying something and thought the following may be a nice feature.

    Say I want to extend a modules library. When loading a module library it looks for MY_* files but they can only extend the core applications libraries, THEY CANNOT EXTEND A CURRENT MODULE LIBRARY. So I have changed some of the load code so it first checks to see if its meant to extend a module library before it checks if your extending a application library and then a base core library. Looking at the code will explain what I mean if you don’t get me.

    function _ci_load_class($class, $params = NULL)
        {
            // Get the class name
            $class = str_replace(EXT, '', $class);
    
            // We'll test for both lowercase and capitalized versions of the file name
            foreach (array(ucfirst($class), strtolower($class)) as $class)
            {
                // {{{ Matchbox
    
                $module = $this->_matchbox->argument(2);
    
                if ($subclass = $this->_matchbox->find('libraries/' . config_item('subclass_prefix') . $class . EXT, $module)) {            
    
                    $baseclass = $this->_matchbox->find('libraries/'. $class . EXT, $module);
                    
                    if ( ! file_exists($baseclass))
                    {
                        log_message('debug', "Unable to load the requested class: ".$class." in module: ".$module);
                        
                        $baseclass = APPPATH.'libraries/'.ucfirst($class).EXT; 
                        
                        if ( ! file_exists($baseclass))
                        {
                            log_message('debug', "Unable to load the requested application class: ".$class);
                            
                            $baseclass = BASEPATH.'libraries/'.ucfirst($class).EXT; 
                        
                            if ( ! file_exists($baseclass))
                            {
                                log_message('debug', "Unable to load the requested class: ".$class);
                                show_error("Unable to load the requested class: ".$class);  
                            }                         
                        }
                    }   
                
                // }}} 
                
                    // Safety:  Was the class already loaded by a previous call?
                    if (in_array($subclass, $this->_ci_classes))
                    {
                        $is_duplicate = TRUE;
                        log_message('debug', $class." class already loaded. Second attempt ignored.");
                        return;
                    }
    
                    include($baseclass);
                    include($subclass);
                    $this->_ci_classes[] = $subclass;
    
                    // {{{ Matchbox
    
                    return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $module);
    
                    // }}}
                }
    
                // Lets search for the requested library file and load it.
                $is_duplicate = FALSE;
    
                // {{{ Matchbox
    
                if ($filepath = $this->_matchbox->find('libraries/' . $class . EXT, $module, 2)) {
                    if (in_array($class, $this->_ci_classes)) {
                        $is_duplicate = true;
                        log_message('debug', $class . ' class already loaded. Second attempt ignored.');
                        return;
                    }
    
                    include($filepath);
                    $this->_ci_classes[] = $class;
                    return $this->_ci_init_class($class, '', $params, $module);
                }
    
                // }}}
    
            } // END FOREACH
    
            // If we got this far we were unable to find the requested class.
            // We do not issue errors if the load call failed due to a duplicate request
            if ($is_duplicate == FALSE)
            {
                log_message('error', "Unable to load the requested class: ".$class);
                show_error("Unable to load the requested class: ".$class);
            }
        }

    Don’t know if my nested for loops is the best way to achive this?

  • #216 / Feb 17, 2008 1:38pm

    zdknudsen

    305 posts

    Sorry, haven’t had much time lately.

    Anyway, does anyone know if I can simply change the license without notice or if any wierd rules apply? Because I think I’d be easiest to just stick with one license.

    adamp1: Good idea 😊 I might implement something similar in the next update.

  • #217 / Feb 17, 2008 7:19pm

    Lone

    350 posts

    Ive got an interesting question to do with matchbox and just want to see what is the best way to achieve it as I haven’t been succesful as of yet. It is similar to a current thread but I think it’s best for me to post it in here as matchbox plays around with the standard routes.

    What I want to do is if no controller is found then to load the ‘page’ controller with the rest of the request eg.

    http://www.domain.com/about-us/the-team

    There is no ‘about-us’ controller so the ‘page’ controller is loaded with the request as ‘about-us/the-team’ and I just use the _remap function in the page controller to load the page.

    What I have tried is the following with routes but when a controller exists (such as ‘user’) the controller isnt loaded and just goes straight to the page controller regardless.

    $route['user/(.*)'] = "user/$1";
    $route[':any'] = "page/$1";

    So for the above example if I went to http://www.domain.com/user/create it would still load the user controller but if I went to http://www.domain.com/staff/john it should goto the page controller.

  • #218 / Feb 17, 2008 9:46pm

    futilemind

    1 posts

    Lone
    I have done this to have a page based cms and allow overrides like /products/hosting/3 to be rendered by a db.

    I unfortunately ended up modifying the router so that it would send all the requests that do not belong to a controller to my page controller and allow it to decide if it is a page or show a 404.

    If anyone has a better way of doing this please let us know.

    Thanks

  • #219 / Feb 17, 2008 11:18pm

    Lone

    350 posts

    Thats exactly what I have done as well futilemind, I just added the following to the Router.php from matchbox for the time being but I would like to have it work without having to hack the core (Zach: maybe a standard matchbox config setting that allows you to allow it to goto the default_controller regardless?)

    Added around line 323 in latest version before the last show_404()

    $this->set_class($this->default_controller);
    $this->set_method('index');
    return;

    And yes I realise this doesn’t show the 404 error but I handle this in the ‘default_controller’

  • #220 / Feb 18, 2008 9:28am

    zdknudsen

    305 posts

    First an update license-wise; I think I’m going to switch from GPL to the LGPL which, as Wolfgang points out, allows software that merely uses the library to be sold without it having to be open-source. Matchbox itself (and any software made by altering it) have to remain open-source, though. At least that’s how I understand things. Please let me know if this is still too restrictive (and why), since I will otherwise change the license soon…-ish.

    Lone: I tried your router definitions on my test installation and it seems to work for me. Only problem is that when the uri consists of only ‘user’ (e.g. no methods or parameters) it is, indeed, redirected to the page controller. However, this can be avoided by removing the slash from your route:

    // Removing the slash in the user-route should do the trick
    $route['user(.*)'] = "user$1";
    
    // Page route is fine.
    $route[':any'] = "page/$1";

    It is worth mentioning that said test installation does not use Matchbox, so please try it out and tell me if it works.

  • #221 / Feb 18, 2008 10:06am

    Lone

    350 posts

    Thanks for that Zach, I will give this a try when I get back to the office tomorrow morning. I swear I had something set like that in the route config file but it just started to get a bit upset.

    My only concern is the requirement of having to specify every controller/module that you want to use - it would be good to be able to bypass this and have the $route[’:any’] happen only when the controller/module can’t be found. The only way I could make this happen was with my above added code.

  • #222 / Feb 18, 2008 11:25am

    WolfgangA

    46 posts

    ...
    Anyway, does anyone know if I can simply change the license without notice or if any wierd
    ...

    - You cannot change the license of an existing released version.
    - However you can change the license for any further version.
    - As the Author, you can also release your SW using a dual license model.

    To be more concret:
    You cannot change matchbox version 0.9.3 to a new license, because you already released the sw under a given license.

    You can however create a new updated version of matchbox like version 0.9.4 (or maybe v1.0 to make your change more “visible”) and release that version under the LGPL.
    Note that the code should somehow be different to the existing version 0.9.3.

    Btw.: Thank you for choosing the LGPL, i really think it is a perfect fit.

  • #223 / Feb 18, 2008 11:43am

    zdknudsen

    305 posts

    Hm. Can I change the license from GPL in Matchbox 0.9.3 Beta to LGPL in Matchbox 0.9.3 (non-beta), then?

    And yes, I too feel LGPL is perfect. 😊

  • #224 / Feb 18, 2008 12:49pm

    Neophyte

    63 posts

    being the copyright holder you can do pretty much anything you want with the license of the code 😊 all it means is all versions upto this point are also available under the terms of the GPL license. but seeing as youre moving to a more leniant license (an open source one at that) its really nothing to think about.

  • #225 / Feb 18, 2008 2:09pm

    adamp1

    772 posts

    I have a quick question. I want to move the modules folder out of the application dir and move it to to the same level as the system folder. How would I do this? Also I want to have multiple applications running of the same CI core files and matchbox modules is this also possible?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases