Coding standards and other questions/comments

Discussion in 'Developers' Forum' started by pedro_morgan, Aug 16, 2007.

  1. pedro_morgan

    pedro_morgan ISPConfig Developer ISPConfig Developer

    Hi there, new user to ISPConfig and love it. Also a php developer (amongst others) as a day job. FOSS as an evening pleasure ;-)

    As a developer what attracted me to ISPCOnfig is that I need it for my business and also its FOSS, I also have time occasionally and wish to contribute. So here are some more questions.

    I just got the svn://svn.ispconfig.org/ispconfig3 . Take it this is the future HEAD ?

    I has a quick look on the code and feel it needs a bit of a tidy up. What is the coding standard ? can see a document anywhere. If there isn't one then I would suggest the PEAR coding standards. http://www.go-pear.org/manual/en/standards.php I can help with this. One thing I don't like is using "foo" where 'foo', should be used ie no substitution, makes for faster and more understandable code.

    Also helpful code comments and "maybe" these should be in english (no offense as I speak Welsh). However I dont advocate all the php docs standard and /* a lot of pointless @param */ etc when a function speaks for itself; it also makes the file twice the size sometimes!

    ADODB is a data abstraction layer for php and its pretty popular and part of PEAR now. http://adodb.sourceforge.net/ Has this ever been looked at. It uses placeholders amongst other features. For example this
    PHP:
    $user addslashes($user);
    $pass addslashes($pass);
    $user $go_api->db->queryOneRecord("SELECT * FROM remote_user WHERE username = '$user' and passwort = md5('$pass')");
    would become
    PHP:
    $user $go_apo->db->getRow('SELECT * FROM remote_user WHERE username = ? and passwort = ?', array($usermd5($pass)));
    Another feature of adodb is the Data dictionary which either creates or updates a table, and thats across any database and I use mySql, m$sql and Interbase/firebird. It does away completely with the Create Table.sql files Here's a snippet
    PHP:
    $tables['job_statuses'] = "
    job_status_id I  AUTO PRIMARY NOTNULL,
    job_status C(50) INDEX jt ,
    so I1,
    color C(20)
    "
    ;
    $tables['job_status_members'] = "
    job_status_id I  INDEX NOTNULL,
    contact_id I INDEX NOTNULL
    "
    ;
    $dict NewDataDictionary($db);
    foreach(
    $tables as $table => $flds){
      
    $sqlarray $dict->ChangeTableSQL($table$flds'');
      
    $dict->ExecuteSQLArray($sqlarray);
    }
    The interfaces seem to have a lot of font and styling in the html. This needs to be ripped out to a stylesheet. Are there any guidelines for doing this or is there a stylesheet already available that includes the page layout ?

    Has anyone conisidered using Smarty Templating (bit biased as I'm a smarty dev.

    More question later maybe ;-)
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Hi,

    first, you must decide between ISPConfig 2 and 3. ISPConfig 3 is a complete different software then ISPConfig 2 and has been written from scratch.

    The things about coding and files with german commants apply only to the old ISPConfig 2 codebase.

    We tested adodb and smarty and decided to not use them in ISPConfig as they are too bloated. The same goes for pear.

    The comments in ISPConfig 3 are completely in english except of one or two files that I did not translate yet and there are lots of comments in the files. I guess you looked at ISPConfig 2 and not 3 as in ISPConfig 2 the comments are in german.

    If you like to build a new theming for ISPConfig 2, feel free to do it.

    The first files of ISPConfig 2 had been written 8 ├Żears ago, thats why they do not contain much stylesheets ;)
     

Share This Page