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.

CodeExtinguisher v2.0 Release Candidate 13

May 13, 2008 2:10am

Subscribe [0]
  • #31 / May 16, 2008 2:57pm

    abmcr

    254 posts

    wouldhide, i would just use the current version and upgrade the core whenever a new version comes out. As long as you don’t modify the core, updating is a simple copy/paste.

    abmcr, Why not structure it like the FieldSet plugin? that way you wouldn’t need to modify the codex_form.php view and make your plugin a one-file download 😊

    Yes i have made it like FieldSet, but it is need to create int the HTML a

    <ul>
       <li><a href="#div1">Div1</a></li>
       <li><a href="#div2">Div2</a></li>
       <li><a href="#div3">Div3</a></li
    </ul>

    my plugin is

    <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); 
    
    include_once('formcontainer.php');
    class TabSet extends FormContainer
    {
        function TabSet($name,$params) { 
            FormContainer::FormContainer($name,$params);
        }
        function getHTML()
        {
            $CI = &get;_instance();
            $CI->codextemplates->css('ui.tabs-css','flora.tabs.css');
            $CI->codextemplates->js('ui.tabs-core-js','ui.core.min.js');
            $CI->codextemplates->js('ui.tabs-js','ui.tabs.min.js');
            $CI->codextemplates->js('ui.tabs-init','ui.tabs.init.js');//set the init js
            
            $html = "\n<div id='".underscore($this->label)."'>".$this->label;
            $html .= $this->form->getHTML();
            $html .= "\n</div>";
            return $html;
        }
    }
    
    ?>

    How i do this code into the plugin?

    $array_tab=array();
        foreach($this->codexadmin->form_setup as $name=>$params){
            if(in_array('TabSet',$params)){
                $array_tab[].="<a ><span>".humanize($name)."</span></a>";
            }
        }
        echo ul($array_tab);

    ? Thank you… ciao!

  • #32 / May 16, 2008 3:20pm

    gusa

    47 posts

    i changed lines #104, #105 and #106 of codexlogin.php from

    $username=mysql_real_escape_string($username);
    $password=mysql_real_escape_string($password);
    $sql = "SELECT id,username,access_level FROM ".$this->users_table." WHERE username='$username' AND password='$password'";

    to

    $username=$this->CI->db->escape($username);
    $password=$this->CI->db->escape($password);
    $sql = "SELECT id,username,access_level FROM {$this->users_table} WHERE username=$username AND password=$password";

    and i solved the problem (i’m tied to sqlserver).

  • #33 / May 16, 2008 5:30pm

    gusa

    47 posts

    hi!
    congrats for the new framework. next month i’m starting an administration tool and i hope (and taking all these progress in account, i’m sure) that codex is going to help.
    let me tell u about my situation. i’m not starting from the scratch. in fact, i’m programming in ci since -let me remember- 2006 (i’m programming a foreign commerce query system; checkout http://www.mercosur.int/sim/es/siaec/view_register/search_by_code for instance). and yeah, off course, i’m not the guy who chooses which database to use (we use sql server 2000) nor which app server (iis; arghhh).
    besides, we have developed some admin stuff, using freakoutlight as auth system. in fact, we have modified fal because we don’t like database sessions. we like php native sessions (via http://codeigniter.com/wiki/Native_session/).

    the first thing i found is that codex uses ob session, so my first question is whether it is possible to extend codexsession without touching the code.

    OMG IT WORKED!

    i found a way to make codex works with native_session + sql server.

    steps:

    0) create the user table and insert the admin user mannualy:

    CREATE TABLE [dbo].[users] (
        [id] [int] NOT NULL ,
        [username] [varchar] (40) COLLATE Traditional_Spanish_CI_AS NOT NULL ,
        [password] [varchar] (40) COLLATE Traditional_Spanish_CI_AS NOT NULL ,
        [access_level] [int] NOT NULL 
    ) ON [PRIMARY]
    GO

    1) overwrite codexsession:

    class codexsession extends Native_Session {
    
        public function __construct()
        {
            parent::Native_Session();
        }
        
        function sess_destroy()
        {
            $this->destroy();
        }
        
        function userdata($item, $read_once = FALSE)
        {
            $userdata = parent::userdata($item);
            if ($read_once === TRUE && $userdata !== FALSE) {
                $this->unset_userdata($item);
            }
            return $userdata;
        }
    
        function set_flashdata($newdata = array(), $newval = '')
        {
            if (is_string($newdata))
            {
                $newdata = array($newdata => $newval);
            }
            
            if (count($newdata) > 0)
            {
                foreach ($newdata as $key => $val)
                {
                    parent::set_flashdata($key, $val);
                }
            }
        } 
    }

    Note: I had to modify backend.php because APPPATH points to ‘codex/application/’ and i need it to point to an absolute path.

    3) change check method of codexlogin.php:

    $username=$this->CI->db->escape($username);
    $password=$this->CI->db->escape($password);
    $sql = "SELECT id,username,access_level FROM {$this->users_table} WHERE username=$username AND password=$password";

    4) change isLoggedIn method of codexlogin.php:

    $sql = "SELECT {$this->users_table}.access_level FROM {$this->users_table} WHERE  {$this->users_table}.id='$user_id'";

    TADAAAAAM!! funciona!!!

    now i can access to one of my tables. i’m getting errors when i try to edit any row, but the first step is done.

    TODO LIST:

    * filter the list of tables in the main-nav (see the attached image).
    * if the main-nav spans into multiple lines, the search-plus display box breakes down.

  • #34 / May 16, 2008 7:35pm

    Majd Taby

    637 posts

    gusa, glad you got it working 😊

    the new design i possted on page 3 addressed the two issues you are facing

  • #35 / May 17, 2008 1:57am

    cu3edweb

    7 posts

    when can I get the new design? I like it.

  • #36 / May 17, 2008 2:59pm

    Majd Taby

    637 posts

    i’m working on it right now 😊

  • #37 / May 19, 2008 12:40am

    Majd Taby

    637 posts

    hey guys, I just wanted to notify everyone subscribed to this thread that RC14 has just been released!

  • #38 / May 19, 2008 3:12am

    abmcr

    254 posts

    ok

  • #39 / Sep 06, 2008 4:55am

    BD-CI-Programmer

    32 posts

    Hi,
    Please clear me step by step tutorial.
    I am waiting

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

ExpressionEngine News!

#eecms, #events, #releases